d3 pie chart transition with attrtween

前端 未结 2 1452
渐次进展
渐次进展 2021-01-22 06:30

i\'m trying to somehow sweep in a half-donut-chart, meaning starting with a blank screen the chart starts drawing at -90 degree (or 270) and performs a halfcircle until reaching

相关标签:
2条回答
  • 2021-01-22 06:33

    after quite some variations and tests it somehow started to work, using these to lines of code:

    var pie = d3.layout.pie().sort(null).startAngle(-90*grad).endAngle(90*grad);
    
    var i = d3.interpolate({startAngle: -90*grad, endAngle: -90*grad},a);
    

    one final "problem" was that the height of the svg was too small and so some segments got cut off, so changing it to

    var height = 800;
    

    ended my search. thanks for any considerations.

    0 讨论(0)
  • 2021-01-22 06:45

    A small typo on the

    var svg = d3.select("body").append("svg").attr("width", width).attr("height", `height)
    

    should be:

    var svg = d3.select("body").append("svg").attr("width", width).attr("height", height)
    
    0 讨论(0)
提交回复
热议问题