Skip to main content
100%

Bar Graph with sub-cats with D3.js

✓ Published0🌍 Public
Ssaikrishnabussa
Last edited Jul 27, 2023
Created on Jul 27, 2023
Forked from HTML Starter

This example shows a bar graph that groups sales data by Sub-Category, with each bar colored by its parent Category (Furniture, Office Supplies, Technology) using a D3 ordinal color scale. It loads a CSV of sample store orders and aggregates total sales per sub-category with `d3.csv`, `d3.sum`, and nested data arrays, then renders the chart as SVG rectangles with `d3.scaleBand`, `d3.scaleLinear`, and `d3.axisBottom`/`d3.axisLeft` for axes and labels. The code runs in a React-compatible plain HTML page using D3 v5.

AI-generated description

A bare minimum HTML page demonstrating use of CSS and JavaScript.

See also React Starter.

MIT Licensed

Similar vizzes