Skip to content

Commit 1c0bca2

Browse files
committed
fix: prevent error with highlighter when no data is set
1 parent 7c7355e commit 1c0bca2

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/ui-chart/highlight/CombinedHighlighter.ts

+9-2
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,18 @@ export class CombinedHighlighter extends ChartHighlighter<CombinedDataProvider>
2121
this.barHighlighter = !barChart.barData ? null : new BarHighlighter(barChart);
2222
}
2323

24+
protected getChartData() {
25+
return this.mChart.combinedData;
26+
}
27+
2428
public getHighlightsAtXValue(xVal, x?, y?) {
2529
this.mHighlightBuffer = [];
30+
const data = this.getChartData();
31+
32+
if (!data) return this.mHighlightBuffer;
2633

27-
const dataObjects = this.mChart.combinedData.datas;
28-
const datasArray = this.mChart.combinedData.datasArray;
34+
const dataObjects = data.datas;
35+
const datasArray = data.datasArray;
2936
const keys = Object.keys(dataObjects);
3037

3138
for (let i = 0; i < keys.length; i++) {

0 commit comments

Comments
 (0)