【发布时间】:2016-05-12 18:44:47
【问题描述】:
这是我一直在研究的codePen。完整的代码最好参考这里,不要把帖子弄得乱七八糟。
我的内圈有问题(甜甜圈内的灰色圆圈,上面有数字 644)。
问题是,内圈被分成两部分(两条路径),我不知道为什么(如果你看得足够近,你也可以看到两部分相交的地方)。
我尝试使用不同的数据创建两个变量,然后将它们传递到内圈 (innerPie) — 请参见下面的代码。
为什么我的圆环图中的圆圈会分成两部分? 我怎么能画一个完整的圆圈?
// this is for the donut chart
var pie = d3.layout.pie()
.sort(null)
.value(function(d) { return d.region; });
// new variable i created just for the inner circle
var innerPie = d3.layout.pie()
.sort(null)
.value(function(d) { return d.toursCreated; });
// the creation of the inner circle
var innerG = svg.selectAll(".innerArc")
.data(pie(data))
.enter().append("g")
.attr("class", "innerArc");
innerG.append("path")
.attr("d", innerArc)
.style("fill", "grey");
【问题讨论】:
标签: javascript d3.js svg data-visualization