Hello All, In my project I'm trying to display a stacked chart. somehow it is displaying a bar chart. can anyone help me with this? Thanks in advance. Here is my files
BarChart.js
import { Bar, mixins } from 'vue-chartjs'
const { reactiveProp } = mixins
export default {
extends: Bar,
mixins: [reactiveProp]
}
<template>
<div class="barChart col-md-6">
<bar-chart :chart-data="barchartDatacollection"></bar-chart>
</div>
</div>
</template>
<script>
import BarChart from "./BarChart.js";
export default {
components: {
BarChart
},
data() {
return {
barchartDatacollection: { labels: [], datasets: [], options: {} },
};
},
mounted() {
this.barchartdata();
},
methods: {
barchartdata() {
this.barchartDatacollection = {
labels: [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
],
datasets: [
{
label: "Bad Style",
data: [40, 47, 44, 38, 27],
backgroundColor: "#512DA8",
hoverBackgroundColor: "#7E57C2",
hoverBorderWidth: 0
},
{
label: "Warning",
data: [10, 12, 7, 5, 4],
backgroundColor: "#FFA000",
hoverBackgroundColor: "#FFCA28",
hoverBorderWidth: 0
},
{
label: "Error",
data: [17, 11, 22, 18, 12],
backgroundColor: "#D32F2F",
hoverBackgroundColor: "#EF5350",
hoverBorderWidth: 0
}
],
options: {
scales: {
xAxes: [
{
stacked: true,
// gridLines: { display: true }
}
],
yAxes: [
{
stacked: true
}
]
},
legend: { display: true }
}
};
}
}
};
</script>