NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm · #535 most downloaded on npm
Interpolate numbers, colors, strings, arrays, objects, whatever!
Last release 5 years ago
no release in 18 months
Release timing varies
gaps range from 4 weeks to 1.2 years
Most releases are documented
notes for 31 of 38 stable releases
Nothing withdrawn
no release was ever pulled
11 years old
39 releases · first in 2015
Update dependencies. Make build reproducible.
This package now requires Node.js 12 or higher. For more, please read Sindre Sorhus’s FAQ .
This package now requires Node.js 12 or higher. For more, please read Sindre Sorhus’s FAQ.
One column per quarter.
v3.0.0
Compare
Allow d3.piecewise to default to using d3.interpolate. #90
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-interpolate 1.x or use a transpiler.
Nothing published for this version
Nothing published for this version
Add d3.interpolateNumberArray .
Adopt explicit files for publishing.
Housekeeping.
Update dependencies.
Add d3.interpolateHue . Add d3.interpolateDiscrete .
Add d3.piecewise .
Small optimization to d3.interpolateArray. Thanks, @jetzhliu.
Fix error trying to interpolate objects without prototypes. Thanks, @devgru!
Nothing published for this version
Fix d3.interpolateRgb.gamma’s opacity interpolation.
Nothing published for this version
Add module entry point to package.json.
module entry point to package.json.Change d3.interpolate to special-case dates (#24).
Fix parsing of SVG transforms in IE (#22).
The d3.interpolate method no longer delegates to d3.interpolators, which has been removed; its behavior is now defined by the library. It is now sligh
The d3.interpolate method no longer delegates to d3.interpolators, which has been removed; its behavior is now defined by the library. It is now slightly faster in the common case that b is a number. It only uses d3.interpolateRgb if b is a valid CSS color specifier (and not approximately one). And if the end value b is null, undefined, true or false, d3.interpolate now returns a constant function which always returns b.
The behavior of d3.interpolateObject and d3.interpolateArray has changed slightly with respect to properties or elements in the start value a that do not exist in the end value b: these properties and elements are now ignored, such that the ending value of the interpolator at t = 1 is now precisely equal to b. So, in 3.x:
d3.interpolateObject({foo: 2, bar: 1}, {foo: 3})(0.5); // {bar: 1, foo: 2.5} in 3.x
Whereas in 4.0, a.bar is ignored:
d3.interpolateObject({foo: 2, bar: 1}, {foo: 3})(0.5); // {foo: 2.5} in 4.0
If a or b are undefined or not an object, they are now implicitly converted to the empty object or empty array as appropriate, rather than throwing a TypeError.
The d3.interpolateTransform interpolator has been renamed to d3.interpolateTransformSvg, and there is a new d3.interpolateTransformCss to interpolate CSS transforms! This allows d3-transition to automatically interpolate both the SVG transform attribute and the CSS transform style property. (Note, however, that only 2D CSS transforms are supported.) The d3.transform method has been removed.
Color space interpolators now interpolate opacity (see d3-color) and return rgb(…) or rgba(…) CSS color specifier strings rather than using the RGB hexadecimal format. This is necessary to support opacity interpolation, but is also beneficial because it matches CSS computed values. When a channel in the start color a is undefined, color interpolators now use the corresponding channel value from the end color b, or vice versa. This logic previously applied to some channels (such as saturation in HSL), but now applies to all channels in all color spaces, and is especially useful when interpolating to or from transparent.
There are now “long” versions of cylindrical color space interpolators: d3.interpolateHslLong, d3.interpolateHclLong and d3.interpolateCubehelixLong. These interpolators use linear interpolation of hue, rather than using the shortest path around the 360° hue circle. See d3.interpolateRainbow for an example. The Cubehelix color space is now supported by d3-color, and so there are now d3.interpolateCubehelix and d3.interpolateCubehelixLong interpolators.
Gamma-corrected color interpolation is now supported for both RGB and Cubehelix color spaces as interpolate.gamma. For example, to interpolate from purple to orange with a gamma of 2.2 in RGB space:
var interpolate = d3.interpolateRgb.gamma(2.2)("purple", "orange");
There are new interpolators for uniform non-rational B-splines! These are useful for smoothly interpolating between an arbitrary sequence of values from t = 0 to t = 1, such as to generate a smooth color gradient from a discrete set of colors. The d3.interpolateBasis and d3.interpolateBasisClosed interpolators generate one-dimensional B-splines, while d3.interpolateRgbBasis and d3.interpolateRgbBasisClosed generate three-dimensional B-splines through RGB color space. These are used by d3-scale-chromatic to generate continuous color scales from ColorBrewer’s discrete color schemes, such as PiYG.
There’s also now a d3.quantize method for generating uniformly-spaced discrete samples from a continuous interpolator. This is useful for taking one of the built-in color scales (such as d3.interpolateViridis) and quantizing it for use with d3.scaleQuantize, d3.scaleQuantile or d3.scaleThreshold.
See CHANGES for all D3 changes since 3.x.
Export to the global d3 in vanilla environments (d3/d3#2840).
d3 in vanilla environments (d3/d3#2840).- Add d3.quantize.
Fix basis interpolation when _t_ is outside [0,1].
Add d3.interpolateRgbBasisClosed.
d3.interpolateArray now ignores extra elements in _a_ as intended (#17).
Simplify, optimize and improve d3.interpolate (#18).
Add d3.interpolateTransformCss (#6).
Add opacity interpolation! See d3-color 0.4 for more details.
rgb(…) or rgba(…) string in accordance with CSSOM.Add interpolateRgb.gamma (#14).
Replace d3.interpolateCubehelix’s optional _gamma_ argument with _interpolate_.gamma.
Nothing published for this version
Fix interpolateObject when _a_ or _b_ is not an object (#10).
The cubehelix and cubehelixLong interpolators now take an optional _gamma_.
Nothing published for this version
Add color space interpolation methods previously in d3-color.
Define d3-interpolate module (and d3_interpolate global), not interpolate.
d3-interpolate module (and d3_interpolate global), not interpolate.Adjust the package.json definition for npm users.
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 →