2019-08-14 09:48:44 +00:00
|
|
|
import { Bar } from 'vue-chartjs';
|
|
|
|
|
2019-08-21 07:29:56 +00:00
|
|
|
const fontFamily =
|
|
|
|
'-apple-system,system-ui,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif';
|
2019-08-14 09:48:44 +00:00
|
|
|
|
2022-03-28 07:38:23 +00:00
|
|
|
const defaultChartOptions = {
|
2019-10-28 15:30:02 +00:00
|
|
|
responsive: true,
|
|
|
|
maintainAspectRatio: false,
|
|
|
|
legend: {
|
|
|
|
labels: {
|
|
|
|
fontFamily,
|
|
|
|
},
|
|
|
|
},
|
2022-03-28 07:38:23 +00:00
|
|
|
datasets: {
|
|
|
|
bar: {
|
|
|
|
barPercentage: 1.0,
|
|
|
|
},
|
|
|
|
},
|
2019-10-28 15:30:02 +00:00
|
|
|
scales: {
|
|
|
|
xAxes: [
|
|
|
|
{
|
|
|
|
ticks: {
|
2019-08-14 09:48:44 +00:00
|
|
|
fontFamily,
|
|
|
|
},
|
2019-10-28 15:30:02 +00:00
|
|
|
gridLines: {
|
2021-05-16 11:11:30 +00:00
|
|
|
drawOnChartArea: false,
|
2019-10-28 15:30:02 +00:00
|
|
|
},
|
2019-08-14 09:48:44 +00:00
|
|
|
},
|
2019-10-28 15:30:02 +00:00
|
|
|
],
|
|
|
|
yAxes: [
|
|
|
|
{
|
|
|
|
ticks: {
|
|
|
|
fontFamily,
|
2020-05-02 09:33:43 +00:00
|
|
|
beginAtZero: true,
|
2019-10-28 15:30:02 +00:00
|
|
|
},
|
|
|
|
gridLines: {
|
2021-05-16 11:11:30 +00:00
|
|
|
drawOnChartArea: false,
|
2019-10-28 15:30:02 +00:00
|
|
|
},
|
2019-08-14 09:48:44 +00:00
|
|
|
},
|
2019-10-28 15:30:02 +00:00
|
|
|
],
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
export default {
|
|
|
|
extends: Bar,
|
2022-03-28 07:38:23 +00:00
|
|
|
props: {
|
|
|
|
collection: {
|
|
|
|
type: Object,
|
|
|
|
default: () => {},
|
|
|
|
},
|
|
|
|
chartOptions: {
|
|
|
|
type: Object,
|
|
|
|
default: () => {},
|
|
|
|
},
|
|
|
|
},
|
2019-10-28 15:30:02 +00:00
|
|
|
mounted() {
|
2022-03-28 07:38:23 +00:00
|
|
|
this.renderChart(this.collection, {
|
|
|
|
...defaultChartOptions,
|
|
|
|
...this.chartOptions,
|
|
|
|
});
|
2019-08-14 09:48:44 +00:00
|
|
|
},
|
2019-10-27 04:54:19 +00:00
|
|
|
};
|