activity 6_Task 1
This example shows a horizontal bar chart of population data for several countries, sorted by the categorical country field on the y-axis and using a quantitative population scale on the x-axis. The visualization renders rectangles as bars, with their height fixed to the band width of the categorical scale and their width proportional to the population values. The implementation relies on D3.js functions such as `d3.axisBottom`, `d3.axisLeft`, and `d3.scaleBand` to construct the axes and layout. The data is fetched from a URL via `fetch` and processed in a `useData` helper function, though the chart itself is drawn using standard SVG `rect` elements appended through a `join` operation. The code demonstrates a basic bar-chart construction with explicit scaling and axis generation.
AI-generated description