how to create labels for data in donut chart using d3.js

后端 未结 2 473
夕颜
夕颜 2021-01-02 01:04

I have a donut chart which updates data on click. I want to add labels to the same data. I am currently using the d3.js javascript library. Here is my code on jsfid

相关标签:
2条回答
  • 2021-01-02 01:23

    Please take a look at: http://nvd3.org/examples/pie.html or http://bl.ocks.org/Guerino1/2295263. Check the code and you should be able to answer this question fairly easy. Have fun!

    0 讨论(0)
  • 2021-01-02 01:32

    You have to use the arc.centroid function. Take a look at the following examples:

    • http://jsfiddle.net/nrabinowitz/GQDUS/
    • http://bl.ocks.org/2295263
    • http://jsfiddle.net/MX7JC/9/
    • http://blog.stephenboak.com/2011/08/07/easy-as-a-pie.html
    0 讨论(0)
提交回复
热议问题