D3 - Line chart (multiple)
✓ Published0🌍 Public
This example displays multiple line charts on a single SVG canvas, tracking the average human wellness index for four countries (India, Sri Lanka, Vietnam, Cambodia) from 2010 to 2019. It first establishes linear scales for time and wellness values, then uses d3.line with path elements to draw each country’s trend, colored via an ordinal scale. The code employs d3.axisBottom and d3.axisLeft for axes, plus the d3-legend library’s legendColor for a horizontal ordinal legend. Data is loaded from a remote CSV using d3.csv, with parsing and flattening for the y-domain.
AI-generated descriptionA bare minimum HTML page demonstrating use of CSS and JavaScript.
See also React Starter.
MIT Licensed