Skip to content

Commit ff694f5

Browse files
committed
chore: Add error message if canvas is not found due to overwritten template
1 parent b504d19 commit ff694f5

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/BaseCharts.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export function generateChart (chartId, chartType) {
6969
},
7070
renderChart (data, options) {
7171
if (this.$data._chart) this.$data._chart.destroy()
72+
if (!this.$refs.canvas) throw new Error('Please remove the <template></template> tags from your chart component. See https://vue-chartjs.org/guide/#vue-single-file-components')
7273
this.$data._chart = new Chart(
7374
this.$refs.canvas.getContext('2d'), {
7475
type: chartType,

0 commit comments

Comments
 (0)