From 9e97ab959274f2243b26968c02bed4a00ea7aca7 Mon Sep 17 00:00:00 2001 From: Timo Hocker Date: Fri, 31 Jul 2020 19:13:59 +0200 Subject: [PATCH] chart completed --- src/components/ChartView.vue | 69 +++++++++++++++++++++++++++++------- src/views/AppView.vue | 25 +++++++++++-- 2 files changed, 80 insertions(+), 14 deletions(-) diff --git a/src/components/ChartView.vue b/src/components/ChartView.vue index 5a5811b..7f63d30 100644 --- a/src/components/ChartView.vue +++ b/src/components/ChartView.vue @@ -1,20 +1,65 @@ diff --git a/src/views/AppView.vue b/src/views/AppView.vue index f28830d..4f1dea7 100644 --- a/src/views/AppView.vue +++ b/src/views/AppView.vue @@ -10,12 +10,18 @@ :items="log" :columns="['data']" /> - + @@ -29,7 +35,22 @@ import ChartView from '../components/ChartView.vue'; export default { components: { TableView, ChartView }, - computed: { ...Vuex.mapState ({ log: (state) => state.log }) }, + computed: { + datasets () { + return [ + { label: 'test', field: 'data/num2', color: 'blue', fill: '#0000' }, + { label: 'abc', field: 'data/num1', color: '#ff000055', fill: '#0000' }, + { label: 'def', field: 'data/num1', color: '#00ff00', fill: '#f005' } + ]; + }, + parsed_log () { + return this.log.map ((l) => { + l.data = JSON.parse (l.data); + return l; + }); + }, + ...Vuex.mapState ({ log: (state) => state.log }) + }, mounted () { this.get_log (); },