Stacked Chart
✓ Published0🌍 Public
CColinEberhardt
Last edited May 28, 2019
Created on Mar 26, 2017
This stacked bar chart displays 2013 energy production data sourced from Eurostat, with each horizontal bar segmented by energy type. The visualization uses d3fc’s Cartesian chart with a band scale for the y-axis and a linear x-axis. A D3 stack layout prepares the series, which are rendered by d3fc’s horizontally oriented stacked bar series. The d3-legend library adds a categorical color legend, while d3.scaleOrdinal assigns colors and d3fc’s autoBandwidth determines bar width.
AI-generated descriptionThis example demonstrates a stacked bar chart using energy production data from eurostat. The chart is constructed from the following components:
- A Cartesian chart, with an ordinal y axis and a linear x axis.
- The data is prepared using a D3 stack layout, which stacks the 'y' values.
- The data is rendered via a horizontally oriented stacked bar series. The auto bandwidth component is used to obtain the bandwidth for the bar series from the y-oriented band scale.
- A legend, courtesy of the d3-legend project.
mit Licensed