Fork of ICE-6: Rendering Marks and Channels with React & D3
This example visualizes the top 20 countries by population using a horizontal bar chart, rendered as SVG marks (rectangles) whose lengths encode population values through a linear scale, while a band scale positions the categorical country labels. The chart is built with React for component structure and state management, using hooks like `useState` and `useEffect` to asynchronously load and parse CSV data via `d3.csv`. Axes are hand-drawn using D3 scales and tick generation, with tick marks and text elements laid out manually within an SVG group transformed by margins, avoiding D3’s axis components. The data originates from a GitHub-hosted iris dataset, though the code references a column for population from January 28, 2020.
AI-generated descriptionA bare minimum HTML page demonstrating use of CSS and JavaScript.
See also React Starter.