您好,我做了一个旭日形图或双层图,它位于饼图和甜甜圈图的中间^^ 当我附加所有路径时,它工作正常:
this.path = this.svg.selectAll("path")
.data(this.partition.nodes(rootData).slice(1))
.enter().append("path")
.attr("d", this.arc)
.style("fill", function(d) { return d.fill; })
.each(function(d){ this._current = thiss.updateArc(d);});
但问题是当我试图在我的所有路径的中间添加一个圆圈所以它不起作用时,这段代码在我所有路径的中间添加圆圈很好
var indicator = this.svg.selectAll('circle')
.data(this.partition.nodes(rootData))
.enter().append("circle")
.attr("cx", function(d){return thiss.arc.centroid(d)[0]})
.attr("cx", function(d){return thiss.arc.centroid(d)[1]})
.attr("r", 5).style('fill','#ff0000');
但我需要在中间但在路径的外部边界上添加这个小圆圈。我不知道如何获得正确的 cx 和 cy 属性,请帮忙?
这是我的目标的截图(黑点是我所拥有的)和(红点是我想要做的)
http://i.stack.imgur.com/GXPYM.jpg