I'm trying to make a chart in Vue.js but I'm getting this error all the time:
Uncaught (in promise) TypeError: this.renderChart is not a function
Here is my code:
<template>
<div>
<canvas ref="donutChart" width="400" height="400"></canvas>
</div>
</template>
<script>
import { Doughnut } from 'vue-chartjs';
export default {
extends: Doughnut,
name: 'donut',
mounted() {
const chartData = {
labels: ['Red', 'Green', 'Blue'],
datasets: [
{
backgroundColor: ['#FF5733', '#33FF57', '#3380FF'],
data: [25, 30, 45]
}
]
};
const chartOptions = {
responsive: true,
maintainAspectRatio: false
};
this.renderChart(chartData, chartOptions);
}
};
</script>