Skip to content

Commit b2a4665

Browse files
committed
Improvement - VueUiXy - Add more checks for annotations
1 parent 875d546 commit b2a4665

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/components/vue-ui-xy.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2937,7 +2937,7 @@ export default {
29372937
},
29382938
annotationsY() {
29392939
const ann = this.FINAL_CONFIG.chart.annotations;
2940-
if (!Array.isArray(ann) || ann.every(a => !a.show)) return [];
2940+
if (!ann || !Array.isArray(ann) || ann.every(a => !a.show)) return [];
29412941
29422942
const visible = ann.filter(a =>
29432943
a.show &&
@@ -3189,13 +3189,15 @@ export default {
31893189
mergedConfig.chart.grid.labels.yAxis.groupColor = null;
31903190
}
31913191
3192-
if (this.config && Array.isArray(this.config.chart.annotations) && this.config.chart.annotations.length) {
3192+
if (this.config && this.config.chart.annotations && Array.isArray(this.config.chart.annotations) && this.config.chart.annotations.length) {
31933193
mergedConfig.chart.annotations = this.config.chart.annotations.map(annotation => {
31943194
return useNestedProp({
31953195
defaultConfig: DEFAULT_CONFIG.chart.annotations[0],
31963196
userConfig: annotation
31973197
})
31983198
})
3199+
} else {
3200+
mergedConfig.chart.annotations = [];
31993201
}
32003202
32013203
// ----------------------------------------------------------------------------

0 commit comments

Comments
 (0)