我想要一个带有均匀薄环的d3 v4旭日形图

时间:2016-09-20 10:00:53

标签: d3.js ember.js

Please find the image attached here .I want the sunburst chart to look like this 我正在使用示例 http://bl.ocks.org/maybelinot/5552606564ef37b5de7e47ed2b7dc099

任何人都可以帮我修改这段代码,以获得带有巨大空心的均匀薄环吗?

1 个答案:

答案 0 :(得分:0)

d3 arc实现非常简单。它全部关于四个参数

  • 由startAngle
  • endAngle
  • innerRadius
  • outerRadius

    var arc = d3.arc() .startAngle(function(d) { return Math.max(0, Math.min(2 * Math.PI, x(d.x0))); }) .endAngle(function(d) { return Math.max(0, Math.min(2 * Math.PI, x(d.x1))); }) .innerRadius(function(d) { return Math.max(0, y(d.y0)); }) .outerRadius(function(d) { return Math.max(0, y(d.y1)); });

以及弧的半径。 在上面描述的参数中做一些改变弧的改变