Skip to main content

Horizontal Bars

✓ Published0🌍 Public
Aarturopolo
Last edited Sep 12, 2017
Created on Sep 12, 2017

The example shows a horizontal bar chart visualizing a small dataset of five values, with bars rendered as colored rectangles scaled proportionally to their data values. It uses d3.v4 with an SVG rendering approach, employing `d3.scaleLinear` to map data values to pixel widths and `d3.scaleOrdinal` with `d3.schemeCategory20` for bar colors. The chart is built via the enter-merge-exit pattern, appending rectangles to an SVG container and updating their `width` and `y` positions based on the data. The data is hardcoded in the script as an array.

AI-generated description

Built with blockbuilder.org

mit Licensed