ICE-6: Rendering Marks and Channels with React & D3
This example shows car sales populations for 10 countries in 2020 using horizontal bars rendered as SVG rectangles. The visualization maps country names to the y-axis with a band scale and population values to the x-axis with a linear scale, displaying tick marks and labels generated manually from scale ticks. It uses React with hooks (useState, useEffect) to load and store CSV data via d3.csv, while d3.scaleBand and d3.scaleLinear define the scales and the axis elements are drawn directly as SVG groups and lines. The data originates from a Kaggle-derived CSV file fetched from a GitHub gist.
AI-generated descriptionA bare minimum HTML page demonstrating use of CSS and JavaScript.
See also React Starter. My dataset was not appropriate for the heatmap, so I found this one https://www.kaggle.com/yamqwe/pregnancy-birth-abortion-rates-in-the-united-stae/version/2 and I took only 8 states to make it readable.