来自本地 json 变量的 d3 饼图
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19716671/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
d3 piechart from local json variable
提问by jotamon
I am trying to create a donut chart using json from a local variable (rather than an external file) I have seen this postbut am having a hard time adjusting my code in the same way
我正在尝试使用来自局部变量(而不是外部文件)的 json 创建一个甜甜圈图我看过这篇文章,但我很难以同样的方式调整我的代码
In the above example
在上面的例子中
d3.json("flare.json", function(error, root) {
was replaced with
被替换为
root = JSON.parse( myjson );
which does not fix my problem
这不能解决我的问题
Check out the fiddle below where my data is loaded as variable titled myJson. How can I use this data for the donut?
查看下面的小提琴,其中我的数据被加载为名为 myJson 的变量。我如何将这些数据用于甜甜圈?

