Skip to main content
Public

Share visualization

Loading preview…

Animated Bar Chart w/ dropdown

vizhub.com

Shared links may look like this on X, LinkedIn, Slack, and Discord.

Before sharing, review the publishing checklist.

Choose how to deliver this visualization

LinkedIn caption

LinkedIn may not keep text supplied by the share sheet. Copy the caption and paste it into the post if needed. You can tag the VizHub company page when posting.

More options

Embed on a websiteCopy iframe embed code
Download & exportPNG, HTML, source ZIP

Animated Bar Chart w/ dropdown

1
AAdan Rodriguez
Last edited Feb 6, 2023
Created on Feb 5, 2023

This example presents an animated bar chart where users can toggle between revenue and profit metrics via a dropdown menu. The chart loads monthly financial data from a CSV file and renders it as SVG rectangles using D3 v7's `scaleBand` and `scaleLinear`. Selecting a different option triggers a `transition` that smoothly animates the bars to their new heights over 750 milliseconds. The visualization uses D3's `select` and `property` methods to handle the dropdown interaction, demonstrating dynamic data binding and transitions.

AI-generated description

A demonstration of how to start using D3 version 6.

Comments

Sign in to join the discussion.

MIT Licensed