2018-08-23 15:37:19 -05:00
|
|
|
import Vue from 'vue';
|
|
|
|
import { Line } from 'vue-chartjs';
|
2018-08-23 17:02:52 -05:00
|
|
|
import * as mergeOptions from 'merge-options';
|
2018-08-23 15:37:19 -05: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-23 17:02:52 -05:00
|
|
|
this.renderChart(this.data, mergeOptions({
|
2018-08-23 17:17:17 -05:00
|
|
|
responsive: true,
|
|
|
|
maintainAspectRatio: false,
|
2018-08-23 15:37:19 -05:00
|
|
|
scales: {
|
|
|
|
xAxes: [{
|
|
|
|
type: 'time',
|
|
|
|
distribution: 'series'
|
|
|
|
}]
|
2018-08-23 18:56:57 -05:00
|
|
|
},
|
|
|
|
tooltips: {
|
2018-08-23 19:39:16 -05:00
|
|
|
intersect: false,
|
|
|
|
mode: 'x',
|
|
|
|
position: 'nearest'
|
2018-08-23 15:37:19 -05:00
|
|
|
}
|
|
|
|
}, this.opts || {}));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|