NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm · #593 most downloaded on npm
Encodings that map abstract data to visual representation.
Last release 5 years ago
no release in 18 months
Release timing varies
gaps range from 2 weeks to 8 months
Most releases are documented
notes for 45 of 57 stable releases
Nothing withdrawn
no release was ever pulled
13 years old
60 releases · first in 2014
Default the base-10 log tick format to ~s instead of .0e . #255
~s instead of .0e. #255Fix log .ticks to return exact values for integer bases. #253
One column per quarter.
Adopt InternMap for ordinal scale domains. #235
This package now requires Node.js 12 or higher. For more, please read Sindre Sorhus’s FAQ.
Adopt d3.timeTicks and d3.utcTicks .
Nothing published for this version
Nothing published for this version
Nothing published for this version
Fix handling of null in quantitative scales; it is now considered an “unknown” value. #241
Fix performance regression with d3.scaleQuantile. #224 Thanks @ilijapuaca !
Fix continuous .nice to ensure that niced domains always span ticks. Thanks, @domoritz ! #209
Fix log .ticks for small domains. #192
Add sequentialQuantile .quantiles .
Add sequential .range (for compatibility with d3-axis).
Remove deprecated *step* argument from *time*.ticks and *time*.nice. #183
Accept iterables wherever appropriate. #163
Note: this release adopts ES2015 language features such as for-of and drops support for older browsers, including IE. If you need to support pre-ES2015 environments, you should stick with d3-scale 2.x or use a transpiler.
Add missing export for d3.scaleDivergingSymlog.
Revert adoption of ES Map; this will happen in a major release.
Add *domain* and *range* (or *interpolator*) convenience constructors for all scale types.
Nothing published for this version
Nothing published for this version
Fix treatment of degenerate domains in d3.scaleSequential.
Move color schemes to d3-scale-chromatic.
Don’t try to generate sub-millisecond ticks for time scales. Thanks, @FracturedShader!
Fix rounding errors in *continuous*.nice.
Nothing published for this version
Nothing published for this version
Add module entry point to package.json.
module entry point to package.json.Nothing published for this version
Deprecate the optional _step_ argument to _time_.ticks; use _interval_.every instead.
Fix order of ticks with log scales with huge descending domains.
Pursuant to the great namespace flattening:
Scales now generate ticks in the same order as the domain: if you have a descending domain, you now get descending ticks. This change affects the order of tick elements generated by axes. For example:
d3.scaleLinear().domain([10, 0]).ticks(5); // [10, 8, 6, 4, 2, 0]
Log tick formatting now assumes a default count of ten, not Infinity, if not specified. Log scales with domains that span many powers (such as from 1e+3 to 1e+29) now return only one tick per power rather than returning base ticks per power. Non-linear quantitative scales are slightly more accurate.
You can now control whether an ordinal scale’s domain is implicitly extended when the scale is passed a value that is not already in its domain. By default, ordinal.unknown is d3.scaleImplicit, causing unknown values to be added to the domain:
var x = d3.scaleOrdinal()
.domain([0, 1])
.range(["red", "green", "blue"]);
x.domain(); // [0, 1]
x(2); // "blue"
x.domain(); // [0, 1, 2]
By setting ordinal.unknown, you instead define the output value for unknown inputs. This is particularly useful for choropleth maps where you want to assign a color to missing data.
var x = d3.scaleOrdinal()
.domain([0, 1])
.range(["red", "green", "blue"])
.unknown(undefined);
x.domain(); // [0, 1]
x(2); // undefined
x.domain(); // [0, 1]
The ordinal.rangeBands and ordinal.rangeRoundBands methods have been replaced with a new subclass of ordinal scale: band scales. The following code in 3.x:
var x = d3.scaleOrdinal()
.domain(["a", "b", "c"])
.rangeBands([0, width]);
Is equivalent to this in 4.0:
var x = d3.scaleBand()
.domain(["a", "b", "c"])
.range([0, width]);
The new band.padding, band.paddingInner and band.paddingOuter methods replace the optional arguments to ordinal.rangeBands. The new band.bandwidth and band.step methods replace ordinal.rangeBand. There’s also a new band.align method which you can use to control how the extra space outside the bands is distributed, say to shift columns closer to the y-axis.
Similarly, the ordinal.rangePoints and ordinal.rangeRoundPoints methods have been replaced with a new subclass of ordinal scale: point scales. The following code in 3.x:
var x = d3.scaleOrdinal()
.domain(["a", "b", "c"])
.rangePoints([0, width]);
Is equivalent to this in 4.0:
var x = d3.scalePoint()
.domain(["a", "b", "c"])
.range([0, width]);
The new point.padding method replaces the optional padding argument to ordinal.rangePoints. Like ordinal.rangeBand with ordinal.rangePoints, the point.bandwidth method always returns zero; a new point.step method returns the interval between adjacent points.
The ordinal scale constructor now takes an optional range for a shorter alternative to ordinal.range. This is especially useful now that the categorical color scales have been changed to simple arrays of colors rather than specialized ordinal scale constructors:
The following code in 3.x:
var color = d3.scaleCategory10();
Is equivalent to this in 4.0:
var color = d3.scaleOrdinal(d3.schemeCategory10);
Sequential scales, are a new class of scales with a fixed output interpolator instead of a range. Typically these scales are used to implement continuous sequential or diverging color schemes. Inspired by Matplotlib’s new perceptually-motived colormaps, 4.0 now features viridis, inferno, magma, plasma interpolators for use with sequential scales. Using d3.quantize, these interpolators can also be applied to quantile, quantize and threshold scales.
<img src="https://raw.githubusercontent.com/d3/d3-scale/master/img/viridis.png" width="100%" height="40" alt="viridis"> <img src="https://raw.githubusercontent.com/d3/d3-scale/master/img/inferno.png" width="100%" height="40" alt="inferno"> <img src="https://raw.githubusercontent.com/d3/d3-scale/master/img/magma.png" width="100%" height="40" alt="magma"> <img src="https://raw.githubusercontent.com/d3/d3-scale/master/img/plasma.png" width="100%" height="40" alt="plasma">
4.0 also ships new Cubehelix schemes, including Dave Green’s default and a cyclical rainbow inspired by Matteo Niccoli:
<img src="https://raw.githubusercontent.com/d3/d3-scale/master/img/cubehelix.png" width="100%" height="40" alt="cubehelix"> <img src="https://raw.githubusercontent.com/d3/d3-scale/master/img/rainbow.png" width="100%" height="40" alt="rainbow"> <img src="https://raw.githubusercontent.com/d3/d3-scale/master/img/warm.png" width="100%" height="40" alt="warm"> <img src="https://raw.githubusercontent.com/d3/d3-scale/master/img/cool.png" width="100%" height="40" alt="cool">
For even more sequential and categorical color schemes, see d3-scale-chromatic.
For an introduction to scales, see Introducing d3-scale.
See CHANGES for all D3 changes since 3.x.
Nothing published for this version
Fix d3.interpolateCubehelixDefault (#68).
Fix _time_.domain for valid numbers but invalid dates (#65).
Export to the global d3 in vanilla environments (d3/d3#2840).
d3 in vanilla environments (d3/d3#2840).You can now pass an optional range to d3.scaleOrdinal.
Optimize continuous scales to create interpolators lazily.
- Update d3-interpolate to 0.8. - Update d3-collection to 0.2.
_time_.tickFormat now takes (and ignores) a suggested tick _count_ (#57).
- Update d3-interpolate to 0.7.
- Update d3-interpolate to 0.6.
Remove some global state to avoid work on initialization.
- Update d3-color to 0.4.
Remove binding of _continuous_.interpolate parameters.
Nothing published for this version
Fix _log_.tickFormat when no _count_ is specified; it now defaults to 10.
Fix crash in _continuous_.tickFormat when the domain is invalid.
Prefix exported symbols with “scale”.
Nothing published for this version
Ordinal scales have been redesigned! 💥
Add viridis, inferno, magma and plasma sequential color scales.
_time_.ticks and _time_.nice no longer take an interval name; use a time interval instead.
Define d3-scale module (and d3_scale global), not scale.
d3-scale module (and d3_scale global), not scale.Fix name of exported global (scale) in provided UMD bundles.
scale) in provided UMD bundles.Adjusted the package.json definition for npm users.
Nothing published for this version
Allow custom time intervals with time.ticks and time.nice.
- Added time and utcTime scales.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →