animated bubble charts in D3
CoffeeScript CSS JavaScript Ruby
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
coffee moving bubble vis to its own repo Nov 11, 2013
css moving bubble vis to its own repo Nov 11, 2013
data moving bubble vis to its own repo Nov 11, 2013
img moving bubble vis to its own repo Nov 11, 2013
js add compiled JS version Nov 7, 2014
LICENSE readme added Sep 18, 2014 add compiled JS version Nov 7, 2014 moving bubble vis to its own repo Nov 11, 2013
index.html updated d3 to latest version - 3.4.11 Sep 18, 2014
index_js.html add compiled JS version Nov 7, 2014

Animated Bubble Chart

Creating Animated Bubble Charts using D3.


This repository contains code to create your own animated bubble chart.

It goes along with the tutorial here:

A live version of this code is here:


D3 needs to be run from a webserver due to how it imports data files.

See more here:

So, to run this visualization locally, from the Terminal, navigate to the directory you checked it out to

 cd ~/code/path/to/gates_bubbles

Then start a webserver locally. If you are on a Linux or Mac, you should be able to use python's built in webserver:

 python -m SimpleHTTPServer 3000

I always use Ruby's thin gem to get things started

 gem install thin # <- just do once
 thin start

Once the server has started, open up your web browser to:

And you should see your bubbles!

Pure JS version

For folks not wanting to dive into Coffeescript, I've added a JS version that is just the compiled Coffeescript. You can see it by navigating to the page:

This was compiled with Coffeescript 1.8, using the command:

 coffee -o js/ -c coffee/

If you would like to try it on your own modified version of the Bubbles.

Remove the Google Analytics Code!

Because this same code is used to run the live version on my site, I (perhaps foolishly) added my own Google Analytics code to the index.html page.

If you build anything with this - and that thing gets put on the internet, just try to remember to change the GA code down at the bottom of the page. At least you could remove the GA call.

Things to consider

Here are a few things that may be issues for you, or may not be

  • Written in Coffeescript

Coffeescript compiles down to JavasScript, and is a really fun language to learn. Try it out!

But if you want, you should be able to compile this tutorial back down to JavaScript - and start from there. People in the comments of the tutorial have already done this.

  • Bubbles might not be the answer to your problems

While the bubbles are flashy and are fun to watch move around, they may not be the best visual form to display your information in. In most cases, when bubbles are used to encode a single variable, the two dimensional bubble inflates and obscures the one dimensional value it is attempting to display.

Kaiser Fung hates bubble charts. You can see lots of reasons why here:

Just keep in mind when you are working with your data.