Skip to main content
100%

D3: Removing values from a chart

✓ Published0🌍 Public
Nnikomc
Last edited Apr 3, 2020
Created on Apr 3, 2020

Twenty vertical bars show a dataset of twenty values, rendered as an SVG bar chart with numeric labels. Clicking the text above the chart removes the first value from the array and updates the chart, using `d3.scaleBand` and `d3.scaleLinear` to recompute domains, `dataset.shift()`, and `transition()` with `duration(500)` to animate the remaining bars and labels into their new positions. The bars exiting the chart slide off the right edge before being removed.

AI-generated description

Learning about scales with D3 (from Scott Murray's book).

MIT Licensed

Similar vizzes