Skip to main content
100%

Sortable Bar Chart

✓ Published0🌍 Public
Mmbostock
Last edited Feb 9, 2016
Created on Jan 9, 2012

A bar chart displays 24 random values from a normal distribution, with bars sorted and animated into ascending or original order every five seconds. The reordering uses d3.transition with staggered delays per bar to make individual movements traceable, referencing Heer and Robertson’s animated transitions. Built with d3.js v3, the chart uses d3.scale.ordinal with rangeRoundBands for vertical positioning, while bar rectangles and text labels are rendered as SVG elements. The x-axis is drawn via d3.svg.axis, and sorting is triggered by a setInterval toggling the index order.

AI-generated description

Quick example demonstrating how to sort a bar chart and animate the reordering. The staggered delay makes it easier to follow individual bars, per Heer & Robertson. Built with d3.js.

gpl-3.0 Licensed

Similar vizzes