Skip to main content
100%

V5 Reusable Examples - Nested data, Chart (line) series DDM - Example 5.3

✓ Published1🌍 Public
JJimMaltby
Last edited Nov 24, 2021
Created on Nov 24, 2021

A nested multi-line chart presents monthly sales data for three fruits across four years, with a drop-down menu filtering the display by fruit type. The visualization uses D3.js v5’s `d3.nest()` to organize the CSV data hierarchically, then renders separate lines per year via `d3.line` and `d3.area` generators. Axis scales are built with `d3.scaleTime()` and `d3.scaleLinear()`, while `d3.axisBottom` and `d3.axisLeft` draw the ticks. Animated transitions update the chart when the menu selection changes, applying color mapping through `d3.scaleOrdinal()` for fruit categories. The reusable chart structure follows the ProD3 pattern within a vanilla HTML implementation.

AI-generated description

An exploration of nesting data. Nested multi-line chart with Drop Down Menu to filter data.

Using the tutorial and series of charts described here:

https://amber.rbind.io/2017/05/02/nesting/

D3.js version: v5.

D3 pattern used:

Addtional help from and aknowledgement to:

MIT Licensed

Similar vizzes