2023-02-21 18:26:09 +00:00
|
|
|
import Vue from 'vue'
|
2023-02-21 20:19:59 +00:00
|
|
|
import { Bar, Doughnut, Line } from 'vue-chartjs'
|
|
|
|
|
|
|
|
Vue.component('BarChart', {
|
|
|
|
extends: Bar,
|
|
|
|
props: {
|
|
|
|
data: { type: Object, required: true },
|
|
|
|
options: {
|
|
|
|
type: Object,
|
|
|
|
required: false,
|
|
|
|
default: () => ({
|
|
|
|
responsive: true,
|
|
|
|
maintainAspectRatio: false,
|
|
|
|
legend: { display: true },
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
data() {
|
|
|
|
this.renderChart(this.data, this.options)
|
|
|
|
},
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.renderChart(this.data, this.options)
|
|
|
|
},
|
|
|
|
})
|
2023-02-21 18:26:09 +00:00
|
|
|
|
|
|
|
Vue.component('LineChart', {
|
|
|
|
extends: Line,
|
|
|
|
props: {
|
|
|
|
data: { type: Object, required: true },
|
|
|
|
options: {
|
|
|
|
type: Object,
|
|
|
|
required: false,
|
|
|
|
default: () => ({
|
|
|
|
responsive: true,
|
|
|
|
maintainAspectRatio: false,
|
|
|
|
legend: { display: true },
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
data() {
|
|
|
|
this.renderChart(this.data, this.options)
|
|
|
|
},
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.renderChart(this.data, this.options)
|
|
|
|
},
|
|
|
|
})
|
2023-02-21 19:55:50 +00:00
|
|
|
|
2023-02-21 20:19:59 +00:00
|
|
|
Vue.component('DoughnutChart', {
|
|
|
|
extends: Doughnut,
|
2023-02-21 19:55:50 +00:00
|
|
|
props: {
|
|
|
|
data: { type: Object, required: true },
|
|
|
|
options: {
|
|
|
|
type: Object,
|
|
|
|
required: false,
|
|
|
|
default: () => ({
|
|
|
|
responsive: true,
|
|
|
|
maintainAspectRatio: false,
|
|
|
|
legend: { display: true },
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
data() {
|
|
|
|
this.renderChart(this.data, this.options)
|
|
|
|
},
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.renderChart(this.data, this.options)
|
|
|
|
},
|
|
|
|
})
|