🌍 Public
Viewing a saved revision (read-only)
52bb337e726e4b7691497ea20f0a1583
Activity 6
This example uses a horizontal bar chart rendered with React and SVG to compare the 2010 populations of twenty countries. The chart sorts countries vertically using an ordinal scale and encodes population values with a linear scale, formatting large numbers with abbreviations (e.g., “1.5B”). It pulls data from a CSV file hosted on GitHub. The code leverages d3’s `scaleBand`, `scaleLinear`, `format`, and `csv` functions, along with custom React components (`AxisBottom`, `AxisLeft`, `Marks`) that render SVG elements. Tooltips display the formatted population value for each bar.
AI-generated descriptionAn example showing the capabilities of VizHub:
- Loads D3 via UNPKG.
- Demonstrates use of
importfrom"d3". - Demonstrates use of
importfrom local ES6 modules.