admin管理员组文章数量:1244397
I would like to add one simple arc in the chart section like a circle:
vis.append("circle")
.style("stroke", "gray")
.style("fill", "white")
.attr("r", 40)
.attr("cx", 50)
.attr("cy", 50);
The provided examples of D3 are working with data properties but i would like to see it without any underlying data.
I would like to add one simple arc in the chart section like a circle:
vis.append("circle")
.style("stroke", "gray")
.style("fill", "white")
.attr("r", 40)
.attr("cx", 50)
.attr("cy", 50);
The provided examples of D3 are working with data properties but i would like to see it without any underlying data.
Share Improve this question asked Aug 22, 2012 at 14:07 OliverOliver 2211 gold badge4 silver badges15 bronze badges1 Answer
Reset to default 13D3 uses a path generator for arcs. If you don't want to data-drive your arc just define the arc generator and add some methods...
var arc = d3.svg.arc()
.innerRadius(50)
.outerRadius(70)
.startAngle(45 * (Math.PI/180)) //convert from degs to radians
.endAngle(3) //just radians
vis.append("path")
.attr("d", arc)
.attr("transform", "translate(50,50)")
You can see a demo here: http://jsfiddle/h9XNz/
本文标签: javascriptHow to add a simple arc with D3Stack Overflow
版权声明:本文标题:javascript - How to add a simple arc with D3 - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1740222354a2244058.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论