d3.js concentric ring chart

前端 未结 3 1141
北海茫月
北海茫月 2021-02-11 04:10

I am looking to develop an arc ring chart. Where each new set of data is displayed as a concentric ring inside the other.

http://jsfiddle.net/NYEaX/101/

I\'ve tr

3条回答
  •  不知归路
    2021-02-11 04:54

    enter image description here

    I've made a version where the chart starts from the top - so different orientation. Be good to put this as a variable - maybe have the option to start the chart in 4 different quadrants.

    http://jsfiddle.net/NYEaX/364/

    I've adjusted

    • the start angle in set Data

      var startAngle = Math.PI*2;

    -the label placements

    valueLabels.enter().append("svg:text")
                                .attr("class", "value")
                                .attr("transform", function(d) {       
                                    return "translate("+(that.getRadiusRing(ir, counts-1))+", 0)";
                                })
                                .attr("dx", function(d, i){
                                    return 0;
                                })
                                .attr("dy", function(d, i){
                                    return (thickness + 4)*i;
                                })
                                .attr("text-anchor", function(d){
                                    return "start";
                                }).text(function(d){
                                    return d.value;
                                });
    

提交回复
热议问题