Skip to main content
100%

Eased Scale

✓ Published0🌍 Public
Mmbostock
Last edited Nov 15, 2016
Created on Jul 1, 2016

A single horizontal axis spans the width of the SVG canvas, with tick labels evenly spaced from 0 to 1 in the domain. The example applies a custom interpolator to a d3.scaleLinear continuous scale, easing the mapping so that intermediate positions follow a quadratic in-out curve rather than a linear progression. The code defines an easeInterpolate function that wraps d3.interpolate and passes the eased time value to the axis position. This demonstrates how to inject a d3.easeQuadInOut easing function into the scale’s interpolation, affecting only the spacing of tick marks rather than the data values.

AI-generated description

This example demonstrates how to ease an interpolator for use with a continuous scale. I’m not sure exactly why you would do this… but it’s possible! An alternative (and probably simpler) approach would be to create a sequential scale with a fixed output interpolator.

gpl-3.0 Licensed

Similar vizzes