Skip to main content
100%

D3: Adding values and elements to a chart

✓ Published0🌍 Public
深深度碎片
Last edited Aug 2, 2016
Created on Aug 2, 2016

A bar chart displays a fixed dataset of 20 values as blue rectangles with white value labels, using D3 v4 scales (`scaleBand` and `scaleLinear`) and SVG rendering. Clicking the text above the chart triggers a transition: a random number between 0 and 25 is appended to the data array, the scales’ domains are recalculated, and both bars and labels animate over one second via `transition()` and `merge()` to accommodate the new element with a slightly narrower band width.

AI-generated description

Built with blockbuilder.org

gpl-3.0 Licensed

Similar vizzes