Activity 6 - Task 2
✓ Published0🌍 Public
This example displays a horizontal bar chart of the top 20 countries by 2010 population, with a formatted x-axis using SI units to abbreviate large numbers. It loads the data from a CSV file using D3's `csv` function and renders the visualization as SVG elements within a React component. The code constructs the chart using D3's `scaleBand` and `scaleLinear` for axes, while custom `AxisBottom`, `AxisLeft`, and `Marks` components generate the ticks and bars, with tooltips showing the exact population values.
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.
MIT Licensed