Hi I\'m looking at the documentation for scales and it shows a format like this var x = d3.scaleLinear([10,130]).range([0,960])
I feel like this is strange beca
They are doing exactly the same thing, but it's just code change happen to D3.js
from version 3 to version 4...
So linear is not property of scale object of d3 framework anymore...
instead it's part of d3 with camelCase syntax...
So d3.js
v3 use d3.scale.linear()
and to create a linear scale with v4 use d3.scaleLinear()
instead...
version 3:
d3.scale.linear()
Constructs a new linear scale with the default domain [0,1] and the default range [0,1]. Thus, the default linear scale is equivalent to the identity function for numbers; for example linear(0.5) returns 0.5.
version 4:
d3.scaleLinear()
Constructs a new continuous scale with the unit domain [0, 1], the unit range [0, 1], the default interpolator and clamping disabled. Linear scales are a good default choice for continuous quantitative data because they preserve proportional differences. Each range value y can be expressed as a function of the domain value x: y = mx + b.