Viewing a saved revision (read-only)
9e77deac61de42a398f6a8b4c5c3f34b
Fork of ICE-6: Rendering Marks and Channels with React & D3
This visualization displays the top 20 countries by COVID-19 case counts using a horizontal bar chart rendered as SVG marks within a React component. The code uses React’s `useState` and `useEffect` hooks to load and parse CSV data via `d3.csv`, with `scaleBand` and `scaleLinear` mapping country names and case numbers to pixel positions. Axis ticks and gridlines are generated manually by iterating over `xScale.ticks()` and the band domain, while each bar’s width derives from the numeric value. The example demonstrates combining D3’s scales and data loading with React’s declarative element creation.
AI-generated descriptionA bare minimum HTML page demonstrating use of CSS and JavaScript.
See also React Starter.