Interactive Earthquake Bar Plot
This interactive bar plot displays earthquake deaths across various regions during the 20th century, with buttons filtering the data into 20-year periods. When a user clicks a button, the bars re-sort by death toll and smoothly animate to their new positions via D3's `transition` on the `rect` elements. The code uses `d3.csv` to load the dataset, `d3.scaleBand` and `d3.scaleLinear` for axes, and `d3.axisBottom` and `d3.axisLeft` to render them. The visualization is built with D3 v7 and rendered as SVG.
AI-generated descriptionData: https://gist.github.com/Junying-Li/72ef4641efd6b4abf371f5d9f4267a56
Iterated from last week's visualization.
What's new?
- Added buttons to interact with users.
- When click on a button, the bar chart will filter and sort data.
- Added transition.
X-axis: region that earthquake occured.
Y-axis: Deaths in earthquake.
This bar plot shows the deaths caused by earchquakes in mutiple regions in different period of 19 century.