Skip to main content
100%

D3: Sorting and re-sorting visual elements with delay

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

A bar chart of twenty numeric values renders with SVG rectangles and text labels. Clicking any bar triggers a re-sorting of the bars and labels in ascending or descending order, with each element transitioning horizontally to its new position. The code uses D3 v4’s `scaleBand` for x-positioning, `scaleLinear` for y-scaling, and `selection.sort` combined with `transition.delay` and `transition.duration` to create a staggered animation effect. Hovering a bar changes its fill to orange via CSS.

AI-generated description

Built with blockbuilder.org

gpl-3.0 Licensed

Similar vizzes