2018-08-23 22:37:19 +02:00
|
|
|
import Vue from 'vue';
|
|
|
|
import { Line } from 'vue-chartjs';
|
2018-08-24 00:02:52 +02:00
|
|
|
import * as mergeOptions from 'merge-options';
|
2018-08-23 22:37:19 +02:00
|
|
|
|
|
|
|
export default Vue.extend({
|
|
|
|
extends: Line,
|
|
|
|
props: {
|
|
|
|
data: {
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
opts: {
|
|
|
|
required: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
data() {
|
|
|
|
this.render();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.render();
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
render() {
|
2018-08-24 00:02:52 +02:00
|
|
|
this.renderChart(this.data, mergeOptions({
|
2018-08-23 22:37:19 +02:00
|
|
|
responsive: false,
|
|
|
|
scales: {
|
|
|
|
xAxes: [{
|
|
|
|
type: 'time',
|
|
|
|
distribution: 'series'
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
}, this.opts || {}));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|