summaryrefslogtreecommitdiff
path: root/src/client/app/desktop/views/components/charts.chart.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/app/desktop/views/components/charts.chart.ts')
-rw-r--r--src/client/app/desktop/views/components/charts.chart.ts42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/client/app/desktop/views/components/charts.chart.ts b/src/client/app/desktop/views/components/charts.chart.ts
new file mode 100644
index 0000000000..6a241631e9
--- /dev/null
+++ b/src/client/app/desktop/views/components/charts.chart.ts
@@ -0,0 +1,42 @@
+import Vue from 'vue';
+import { Line } from 'vue-chartjs';
+import * as mergeOptions from 'merge-options';
+
+export default Vue.extend({
+ extends: Line,
+ props: {
+ data: {
+ required: true
+ },
+ opts: {
+ required: false
+ }
+ },
+ watch: {
+ data() {
+ this.render();
+ }
+ },
+ mounted() {
+ this.render();
+ },
+ methods: {
+ render() {
+ this.renderChart(this.data, mergeOptions({
+ responsive: true,
+ maintainAspectRatio: false,
+ scales: {
+ xAxes: [{
+ type: 'time',
+ distribution: 'series'
+ }]
+ },
+ tooltips: {
+ intersect: false,
+ mode: 'x',
+ position: 'nearest'
+ }
+ }, this.opts || {}));
+ }
+ }
+});