In reviewing this discussing on visualizing data values with circles...
https://groups.google.com/d/topic/d3-js/ImdUrzVyfyo/discussion
...I have been wondering about the cleanest way to map values to the area of a circle.
First, the math. In effect, the datum value will become the area, but of course SVG circle sizes are specific with a radius "r" value. So, to get from area to radius, we use:
r = sqrt( area / π )
In this thread:
https://groups.google.com/d/topic/d3-js/s7HwxUx2OQ8/discussion
...Mike suggests using a sqrt scale, like so:
> Generally by using a d3.scale.sqrt, and by setting the lower bound of
> the domain and range to 0. For example:
>
> var r = d3.scale.sqrt()
> .domain([0, 5000])
> .range([0, 20]);
But does this really account for π, or is it not needed in this context? My instinct (which may be wrong!) is to define that sqrt scale, but then divide by π before passing in the value, as in:
scale( value / Math.PI );
What do you think?
Thanks,
Scott