🌍 Public
Viewing a saved revision (read-only)
f8b56a209c7949ada1c1bbbfff2e5230
Linear Regression Line with D3.js
This visualization plots the correlation between a country's happiness score and its health expenditure per person, using a scatter plot of circles and an overlaid linear regression trendline. The data is loaded from a CSV file via `d3.csv` and rendered as SVG. The least-squares computation is performed manually in `index.js` to calculate slope, intercept, and r-squared, which are then used to draw the line via `d3.svg.line` and the `d3.scale.linear` axis scales.
AI-generated descriptionA regression line visualization using D3 and vega-lite