json - D3JS Map Citiy Circles -
i'm creating map of germany d3js visualize data. added cities using csv, shown circles in map. want cities have different color more data used in them. have idea how can achieve this?
you can declare range of color this:
var color = d3.scale.linear() .domain([d3.min(array), d3.max(array)]) .range(["#fff7f3", "#49006a"]);
then style every circle:
.style("fill", function(d) { return color(+d.data); });
but need compact data 1 value per city so:
d.values.reduce(function(sum, d){ return sum + d.amount; },0)
here's example mike's site: http://bl.ocks.org/mbostock/4060606
Comments
Post a Comment