Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

D3: Removing values from a chart

Public visualization

Viewing a saved revision (read-only)

f872831f55c5405aa994d92b04eb2815

D3: Removing values from a chart

0 stars0🌍 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).