Skip to content

Commit 4409b98

Browse files
authored
fix(legacy-charts): tune chartoptions type check (#821)
1 parent 48df4d7 commit 4409b98

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

legacy/src/Charts.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,10 @@ export function generateChart(chartId, chartType, chartController) {
7373
},
7474
computed: {
7575
hasAnnotationPlugin() {
76-
return (
77-
Object.keys(this.chartOptions).length > 0 &&
78-
'plugins' in this.chartOptions &&
79-
Object.keys(this.chartOptions.plugins).length > 0 &&
80-
ANNOTATION_PLUGIN_KEY in this.chartOptions.plugins
81-
)
76+
const pluginSettings =
77+
this.chartOptions?.plugins?.[ANNOTATION_PLUGIN_KEY]
78+
79+
return typeof pluginSettings !== 'undefined'
8280
}
8381
},
8482
created() {

0 commit comments

Comments
 (0)