From 429d0d59a9400e85eada9ee29c8667b3033afb48 Mon Sep 17 00:00:00 2001 From: T__o Date: Fri, 24 Apr 2020 18:18:27 +0200 Subject: [PATCH] local config with reset (buggy) --- brain.md | 27 +- src/App.vue | 400 +++++++++++++----------- src/components/ChartConfig.vue | 30 +- src/components/CountriesConfig.vue | 12 +- src/components/d3/MultiCountryChart.vue | 4 +- 5 files changed, 261 insertions(+), 212 deletions(-) diff --git a/brain.md b/brain.md index fad8571..5f00766 100644 --- a/brain.md +++ b/brain.md @@ -3,21 +3,26 @@ ## First production : -load data source +OK load data source +OK git clean vuejs prod -git clean hosting -load data source -local storage : - save all data - save timeStamp - -on load - if delay > 1hour : reload data - - +Save user config to local +reset mode + +Charts modes: +- Country day decal +- sync on first day at xxx +- divide by country population + + + + + + +### Data source Data source : https://github.com/pomber/covid19 diff --git a/src/App.vue b/src/App.vue index 5eea070..c23ebfe 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,215 +1,253 @@ diff --git a/src/components/ChartConfig.vue b/src/components/ChartConfig.vue index 9aca65b..1014982 100644 --- a/src/components/ChartConfig.vue +++ b/src/components/ChartConfig.vue @@ -1,7 +1,7 @@ @@ -83,16 +92,15 @@ props: ['configs', 'configLists'], components: {Counter}, data() { - return {} - }, - watch: { - config(prev,neww){ - if (prev.ymax !== neww.ymax){ - console.log('new y',neww.ymax) - } + return { } }, - methods: {}, + methods: { + resetConfig() { + this.configs.resetConfig = true + } + }, + computed: { } } @@ -103,8 +111,8 @@ margin: 0px; } - .ymax{ - max-width:50%; + .ymax { + max-width: 50%; } \ No newline at end of file diff --git a/src/components/CountriesConfig.vue b/src/components/CountriesConfig.vue index be348a1..930fb75 100644 --- a/src/components/CountriesConfig.vue +++ b/src/components/CountriesConfig.vue @@ -17,8 +17,7 @@ - - + @@ -60,15 +59,11 @@ // TODO : change the base list used for countries } }, - created() { - this.setColors(); - }, watch: { selected() { if (this.selected === '') return // prevent the reset in this function if (this.configs.selected.map(d => d.name).indexOf(this.selected) === -1) { this.configs.selected.push({name: this.selected}) - this.setColors() } this.addCountry = !this.addCountry this.selected = '' @@ -90,6 +85,11 @@ }, }, computed: { + // Add colors with selected + getSelected(){ + this.setColors() + return this.configs.selected + }, getActiveCountries() { // TODO filter out selected countries return [] diff --git a/src/components/d3/MultiCountryChart.vue b/src/components/d3/MultiCountryChart.vue index b99511b..925ddc0 100644 --- a/src/components/d3/MultiCountryChart.vue +++ b/src/components/d3/MultiCountryChart.vue @@ -91,11 +91,9 @@ }, mounted() { this.drawAxis() - console.log('dataType', this.dataType) }, watch: { - scaleType(neww) { - console.log('', neww) + scaleType() { this.drawAxis() }, countries() {