Skip to main content
100%

Activity6_Task2

✓ Published0🌍 Public
DDouglas mochama
Last edited Apr 14, 2024
Created on Apr 14, 2024

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 description

An example showing the capabilities of VizHub:

  • Loads D3 via UNPKG.
  • Demonstrates use of import from "d3".
  • Demonstrates use of import from local ES6 modules.
MIT Licensed

Similar vizzes