third
✓ Published1🌍 Public
This example shows the monthly sales trend from 2021 to 2025 as a smooth line chart. The chart displays a single steelblue line with orange data points, with rotated month labels on the x-axis and a linear y-axis. Built with D3 v6, the code uses `d3.csv` to load `sales_trend.csv`, `d3.scaleTime` and `d3.scaleLinear` for axes, `d3.line` with `d3.curveMonotoneX` for the smoothed path, and `d3.axisBottom` and `d3.axisLeft` for tick marks. The SVG rendering includes a title and axis labels.
AI-generated descriptionMonthly Sales Trend Visualization
This project visualizes monthly sales data from 2021 to 2025 using D3.js.
Files
index.html: Main HTML fileindex.js: JavaScript implementation for the line chartsales_trend.csv: Sales data by month
How to Run
- Open
index.htmlin a web browser - The line chart will automatically load and display the sales trend
Data Format
The CSV file contains two columns:
month: Month and year in format "MMM-YYYY" (e.g., "Jan-2021")sales: Sales figures for that month
MIT Licensed