Skip to main content
100%

Transition in bar chart : Easy interaction using CSS property transition

✓ Published0🌍 Public
NNita
Last edited Mar 12, 2021
Created on Mar 12, 2021
Forked from Customizing Axes

This visualization displays the top 10 most populous countries based on 2018 United Nations estimates, using horizontal bars rendered as SVG rectangles. It builds on a basic bar chart by adding a CSS transition property that smoothly changes bar fill color from steelblue to red on hover, demonstrating simple interaction without D3's transition system. The code uses d3.csv to load population data, d3.scaleLinear and d3.scaleBand for scaling, and d3.axisLeft and d3.axisBottom with custom tick formatting for the axes. The styling in styles.css handles the transition effect.

AI-generated description

This bar chart shows population of the top 10 most populous countries. The data comes from the year 2018 estimate in United Nations: World Population Prospects 2017. It also demonstrates customization of D3 axes.

See also the first bar chart visualization that this one builds on: Making a Bar Chart.

MIT Licensed

Similar vizzes