Table of Contents
- Continuous Scales
- Introducing d3-scale
- Sequential Scales vs Diverging Scales
- linear, power, log, identity, time, or sequential color
continuousstands for the returned object from one of the functions like
- Inversion is useful for interaction, say to determine the data value corresponding to the position of the mouse.
domainis specified, sets the scale’s domain to the specified array of numbers.
- If the elements in the given array are not numbers, they will be coerced to numbers.
- Unlike the
domain, elements in the given array need not be numbers
- Any value that is supported by the underlying
- Same as
.range(), but use
d3.interpolateRoundinstead of the default interpolator, which will round the resulting value to the nearest integer.
clampis specified, enables or disables clamping accordingly.
- If clamping is disabled and the scale is passed a value outside the domain, the scale may return a value outside the range through extrapolation.
- The default interpolator may reuse return values.
- If the range values are objects, then the value interpolator always returns the same object, modifying it in-place.
- Returns approximately
countrepresentative values from the scale’s domain.
continuous.tickFormat([count[, specifier]]) reference
- Extends the
domainso that it starts and ends on nice round values.
- This method typically modifies the scale’s domain, and may only extend the bounds to the nearest round value.
Introducing d3-scale tutorial
A scale is a function that takes an abstract value of data, such as the mass of a diamond in carats, and returns a visual value such as the horizontal position of a dot in pixels. With two scales (one each for x and y), we have the basis for a scatterplot.
Sequential Scales vs Diverging Scales discussion
- Both are similar to continuous scales
- However, unlike continuous scales, the output range is fixed by its interpolator and not configurable.
Examples of these types are as follows:
d3.scaleSequential, but requires that the domain has three values, and maps to a diverging interpolator such as
You can use these scales with interpolators provided by