最小弧长/宽度的d3 v4饼

时间:2018-08-13 12:10:38

标签: javascript d3.js

我正在尝试使用d3 v4创建通用饼图。 有时数据会产生一条很小的弧,看起来像一条细线。

,如以下示例所示:enter image description here

生成此图表的代码为:

this.pie = d3.pie()
  .sort(null)
  .value((d) => {
    if (this.allValuesZero) {
      return 1;
    } else {
      return d.value;
    }
  })
  .startAngle(-90 * (pi / 180))
  .endAngle(90 * (pi / 180));

this.arc = d3.arc()
  .outerRadius(radius - 3)
  .innerRadius(radius - 12)
  .cornerRadius(9)
  .padAngle(.05);

如何在渲染长度之前进行操作?

0 个答案:

没有答案
相关问题