Activity 7 - Bar Chart
✓ Published0🌍 Public
This example shows a horizontal bar chart comparing population figures for 20 countries in 2010, with each bar representing a country’s population sorted alphabetically. It uses React to render SVG elements with D3 scales (scaleBand for the y-axis and scaleLinear for the x-axis), along with the csv loader from D3 v5 to fetch data from a GitHub-hosted CSV file. Custom axis components render tick marks and labels, while formatted tick values convert large numbers into abbreviated units like “B” for billions.
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