d3 piechart from local json variable

后端 未结 1 1629
忘了有多久
忘了有多久 2021-02-14 03:02

I am trying to create a donut chart using json from a local variable (rather than an external file) I have seen this post but am having a hard time adjusting my code in the same

1条回答
  •  旧巷少年郎
    2021-02-14 03:46

    1. Rename your JSON variable to data.
    2. Delete the d3.json call (but keep the code within it).

    Complete jsfiddle here. You also need to append your SVG to "body" and not "#body".

    0 讨论(0)
提交回复
热议问题