Skip to content

Commit c149ff2

Browse files
authored
fix: fix guide line render error without plot data (#1242)
1 parent e20a592 commit c149ff2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/components/guide-line.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { getScale } from '@antv/scale';
2-
import { assign, deepMix, mix, each, isArray, isString, isNumber, contains, toArray, clone } from '@antv/util';
2+
import { assign, deepMix, mix, each, isArray, isString, isNumber, contains, toArray, clone, isEmpty } from '@antv/util';
33
import { getMean, getMedian } from '../util/math';
44

55
export default class GuideLine {
@@ -16,7 +16,7 @@ export default class GuideLine {
1616
private _init() {
1717
const { yField, data } = this.plot.options;
1818
const plotData = this.plot.processData(data);
19-
if (!isNumber(plotData[0][yField])) {
19+
if (isEmpty(plotData) || !isNumber(plotData[0][yField])) {
2020
return;
2121
}
2222
const defaultStyle = this.getDefaultStyle();

0 commit comments

Comments
 (0)