d3.js - d3 donut charts of varying radius -


i recreate similar following examples:

http://bl.ocks.org/mbostock/3888852

http://bl.ocks.org/mbostock/1305111

the difference want control radius of each donut, rather having same of them. how dynamically vary radius of donut charts?

for this, need adjust .innerradius() and/or .outerradius() dynamically each appended pie chart, example

svg.selectall(".arc")   .data(function(d) { return pie(d.ages); }) .enter().append("path")   .attr("class", "arc")   .attr("d", function(d, i) { return arc.innerradius(radius - 30 * math.random())(d, i); })   .style("fill", function(d) { return color(d.data.name); }); 

complete example here. in real example, you'd want specify radius in data , reference instead of making random number each segment of pie chart. can have same radius segments in same pie chart.


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -