Line chart
✓ Published0🌍 Public
This example displays a line chart of total sales per year, with a single steelblue path plotted against a time-scaled x-axis and a linear y-axis. The chart is a static SVG rendered in D3 v7. The code loads a CSV from a GitHub gist (titanic.csv), aggregates sales data by summing each year’s column, and uses `d3.scaleTime`, `d3.scaleLinear`, `d3.line`, and `d3.axisBottom`/`d3.axisLeft` to construct the visualization. The SVG is sized at 800x400 pixels with margins, and axis labels are added as text elements.
AI-generated descriptionAn example showing the capabilities of VizHub:
- Loads D3 via UNPKG.
- Demonstrates use of
importfrom"d3". - Demonstrates use of
importfrom local ES6 modules.
MIT Licensed