Activity6_Task2
✓ Published0🌍 Public
This example visualizes the top 20 most populous countries in 2010 as a horizontal bar chart, with bars sorted in descending order and displayed using an SVG canvas. The chart loads population data from a remote CSV file via D3’s `d3.csv` method, then uses `d3.scaleLinear` for the x-axis (population in millions) and `d3.scaleBand` for the categorical y-axis (country names). Axes and labels are rendered using `d3.axisBottom` and `d3.axisLeft`, while bars are drawn as `rect` elements with a steelblue fill. The code also demonstrates local ES6 module imports and D3 loading via UNPKG.
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