Skip to content

Instantly share code, notes, and snippets.

@capricec
capricec / bubble_by_area.js
Created December 6, 2015 22:16
Sizing Bubble Charts by Area
/* In working with bubble charts, I've regularly had to work out the math to size the
area of the bubbles correctly. It's a common mistake and criticism of bubble charts,
when values determine the radius of the bubble rather than the area.
Here's a simple function to do it for you!
*/
// This is the maximum value of the data attribute you wish to map as bubbles
var maxvalue = 70000;
// This is your desired maximum radius