Skip to main content
100%

Stacked-to-Grouped | JSON Data, Horizontal Bars

✓ Published0🌍 Public
NNikhilkuyya
Last edited Feb 12, 2018
Created on Feb 12, 2018

This example shows horizontal bars transitioning between stacked and grouped layouts using sequenced animations. The visualization reads static JSON data containing five series with three numeric values each, and users can toggle between the two view modes via custom radio buttons. Built with D3 v4, the code uses `d3.stack` to prepare the data, `d3.scaleLinear` and `d3.scaleBand` for positioning, and applies animated transitions via the `transition` API to preserve object constancy, allowing viewers to track individual bars across the layout change. The SVG rendering includes a left axis and color-coded series, with the interaction and animation design inspired by Heer and Robertson's work on animated transitions.

AI-generated description

switch between stacked and grouped layouts using sequenced transitions ✨

animations preserve object constancy and allow the user to follow the data across views

animation design by Heer and Robertson inspired by Byron and Wattenberg

this iteration draws horizontal bars from static data

an ES2015 implementation in something like the airbnb style

inspired by Stacked-to-Grouped Bars from @mbostock

custom radio buttons from the codepen Pure CSS & HTML cross-browser elegant Radio Buttons from knitevision1

you can also view this set of experiments in github repo form

👏 to @alexmacy for wading through a few thousand transition errors to help me find the data-prep 🐛 causing them all

Stacked-to-Grouped | Generated Data, Vertical Bars
Stacked-to-Grouped | JSON Data, Vertical Bars
Stacked-to-Grouped | Generated Data, Horizontal Bars
Stacked-to-Grouped | JSON Data, Horizontal Bars
Stacked-to-Grouped | JSON Data, Horizontal Bars, String Series Names

forked from <a href='http://bl.ocks.org/micahstubbs/'>micahstubbs</a>'s block: <a href='http://bl.ocks.org/micahstubbs/501e578009b75738910e47b86b493168'>Stacked-to-Grouped | JSON Data, Horizontal Bars</a>

forked from <a href='http://bl.ocks.org/Thanaporn-sk/'>Thanaporn-sk</a>'s block: <a href='http://bl.ocks.org/Thanaporn-sk/e02a3e3afe112362124f9cbbbcccdfed'>Stacked-to-Grouped | JSON Data, Horizontal Bars</a>

forked from <a href='http://bl.ocks.org/lorenzopub/'>lorenzopub</a>'s block: <a href='http://bl.ocks.org/lorenzopub/93256013a8d4a5fba2c71e8057a01872'>Stacked-to-Grouped | JSON Data, Horizontal Bars</a>

mit Licensed

Similar vizzes