Fork of React & D3 Vibecoding Starter
This example recreates Charles Minard’s classic 1812 Napoleon march chart, tracing army size against longitude for both the advance to Moscow and the retreat, with a temperature annotation at the coldest point. The D3.js v7 code uses `scaleLinear` for axes, `scaleOrdinal` for the advance/retreat color encoding, and `curveCatmullRom` line smoothing. A React wrapper in `app.jsx` uses a `ResizeObserver` to feed container dimensions into the D3 rendering pipeline, which builds axes, legend, and the line-and-circle marks. The data is loaded from a CSV via `d3.csv`.
AI-generated descriptionNapoleon's March to Moscow Visualization
This visualization depicts Napoleon's march to Moscow in 1812, showing the gradual decline in troop numbers during both advance and retreat phases.
The data is based on Charles Minard's famous visualization, which is considered one of the best statistical graphics ever created.
Key features:
- Longitude on the x-axis
- Troop count on the y-axis
- Color-coding for advance and retreat phases
- Temperature annotation for the retreat phase
The visualization shows how Napoleon's army was reduced from 422,000 to just 10,000 men during the campaign, with temperatures dropping to -30°C during the retreat.