Skip to content

Commit

Permalink
fix: 当饼图数据有可能为 null, 会导致计算结果 NaN (#1371)
Browse files Browse the repository at this point in the history
  • Loading branch information
simaQ authored Jul 30, 2020
1 parent 155bce4 commit 1ccfda5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/plots/pie/component/label/spider-label.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,10 @@ export default class SpiderLabel {
const colorField = this.options.fields[1];
const colorScale = this.view.geometries[0].scales[colorField];
const colorIndex = colorScale.scale(d[colorField]);
const shapeIndex = Math.floor(colorIndex * (shapes.length - 1));
color = shapes[shapeIndex].attr('fill');
if (colorIndex) {
const shapeIndex = Math.floor(colorIndex * (shapes.length - 1));
color = shapes[shapeIndex].attr('fill');
}
}
// 组装label数据
const label: LabelData = {
Expand Down

0 comments on commit 1ccfda5

Please sign in to comment.