🌍 Public
Viewing a saved revision (read-only)
82eb68e2efb04da89719a7bd44d031b4
Fork of D3 Starter
This example demonstrates how different orderings of categorical data affect the readability of a bar chart, using a slice of a sample CSV dataset filtered for 2023 with CO₂ emissions per capita as the bar length. Three buttons toggle the chart’s sort order—alphabetical, by value, or by a derived attribute computed as total CO₂ divided by population. The chart is implemented as a reusable function following the closure pattern, using d3.scaleBand, d3.scaleLinear, d3.axisBottom, and d3.axisLeft to render SVG elements, with chainable getter/setters for its properties.
AI-generated description