From 458b5c45b7e87b084c62a415e86fd8573685769e Mon Sep 17 00:00:00 2001 From: T__o Date: Thu, 30 Apr 2020 19:04:06 +0200 Subject: [PATCH] v0.04 Fix reset --- README.md | 3 ++- brain.md | 9 +-------- doc.md | 2 ++ src/App.vue | 23 +++++++++++------------ src/components/ChartConfig.vue | 2 +- src/components/html/Counter.vue | 30 ++++++++++++++++++------------ 6 files changed, 35 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index 5987f8b..e053966 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,9 @@ Data source from : https://github.com/pomber/covid19 ## Features : +- Maths functions : Exp, pow, Logistic - sync X axis at a value -- reset (broken, need reload page too) +- reset - set a limit for y axis - select first and last day - select data source (confirmed, deaths, recovered) diff --git a/brain.md b/brain.md index 5f00766..51f8173 100644 --- a/brain.md +++ b/brain.md @@ -3,14 +3,7 @@ ## First production : -OK load data source -OK git clean -vuejs prod -hosting - - -Save user config to local -reset mode +User Local Presets (N) Charts modes: - Country day decal diff --git a/doc.md b/doc.md index 51cd3b1..f7122a5 100644 --- a/doc.md +++ b/doc.md @@ -3,6 +3,8 @@ # Changelog +v0.04 Fix reset +v0.03 maths functions v0.02 sync x axis v0.01 repack, data auto loading diff --git a/src/App.vue b/src/App.vue index 02f4c7e..ec9b7d7 100644 --- a/src/App.vue +++ b/src/App.vue @@ -125,7 +125,7 @@ }, }, countriesConfig: { - selected: [{name: "France"}, {name: "Italy"}], + selected: [{name: "France"}, {name: "Italy"},{name:"Spain"},{name:"United Kingdom"}], basePalette: "tolRainbowColor" }, } @@ -137,13 +137,13 @@ props: { source: String, }, - data: () => ({ + data () { return { drawer: true, title: 'Cov Charts', allData: {}, chartWidth: 500, - chartConfig: defaultUserConfig.chartConfig, - countriesConfig: defaultUserConfig.countriesConfig, + chartConfig: Object.assign({},defaultUserConfig.chartConfig), + countriesConfig:Object.assign({}, defaultUserConfig.countriesConfig), configLists: { scaleList: ['log', 'linear'], typesList: ['confirmed', 'deaths', 'recovered'], @@ -154,7 +154,7 @@ //all: Object.keys(AllData).sort(), }, debug: false, - }), + }}, watch: { drawer() { console.log('dd', this.drawer) @@ -189,25 +189,21 @@ uc = JSON.parse(uc) this.countriesConfig = uc.countriesConfig this.chartConfig = uc.chartConfig - this.ccc("loadConfig storage") } else { - this.countriesConfig = defaultUserConfig.countriesConfig - this.chartConfig = defaultUserConfig.chartConfig - this.ccc("loadConfig default") + this.countriesConfig = Object.assign({},defaultUserConfig.countriesConfig) + this.chartConfig = Object.assign({},defaultUserConfig.chartConfig) } }, saveConfig() { - this.ccc("saveConfig") let userConfig = {countriesConfig: this.countriesConfig, chartConfig: this.chartConfig} localStorage.setItem('userConfig', JSON.stringify(userConfig)) }, resetConfig() { localStorage.setItem('userConfig', 'null') - this.ccc("resetConfig") this.loadConfig() }, ccc(a, b) { - if (this.debug) console.log(a, b) + if (this.debug) console.log(a, b?b:'') }, addMathFunctions(cdata, ymax) { @@ -388,6 +384,9 @@ padding: 2px 0; } + .v-list-item__action{ + margin: 8px 0; + } .v-text-field.v-text-field--solo .v-input__control { min-height: 20px; } diff --git a/src/components/ChartConfig.vue b/src/components/ChartConfig.vue index 9feb22a..ba8f534 100644 --- a/src/components/ChartConfig.vue +++ b/src/components/ChartConfig.vue @@ -88,7 +88,7 @@ - Maths + Maths Functions diff --git a/src/components/html/Counter.vue b/src/components/html/Counter.vue index c73830d..1ab18ee 100644 --- a/src/components/html/Counter.vue +++ b/src/components/html/Counter.vue @@ -1,7 +1,7 @@ @@ -17,18 +17,16 @@ classname: {type: String, default: 'themeGreen'}, }, data() { - return { - value: this.input, - } + return {} }, methods: { click(dirfactor) { - this.value = this.value + (dirfactor * this.inc) - if (this.value > this.max) this.value = this.max - if (this.value < this.min) this.value = this.min - this.$emit('input', this.value) + let input = this.input + (dirfactor * this.inc) + if (input > this.max) input = this.max + if (input < this.min) input = this.min + this.$emit('input', input) } - } + }, } @@ -44,16 +42,18 @@ padding: 0; width: 15px; line-height: 15px; - /*/margin: 0 px 3 px 0 px 3 px;*/ + /*/margin: 0 px 3 px 0 px 3 px;*/ } .bleft, .bright { border: 0px solid red; border-radius: 5px; } + .bleft { margin-right: 3px; } + .bright { margin-left: 3px; } @@ -61,14 +61,17 @@ .themeGreen.counter { border: 1px solid #2c3e50; background: #d3e3e0; - color:white; + color: white; } + .themeGreen.counter button { background: #d3e3e0; } + .themeGreen .bleft { border-right: 1px solid #2c3e50; } + .themeGreen .bright { border-left: 1px solid #2c3e50; } @@ -76,16 +79,19 @@ .themeGrey.counter { border: 0px solid #8ecaf9; background: inherit; - color:white; + color: white; } + .themeGrey.counter button { background: #767676; width: 18px; line-height: 18px; } + .themeGrey .bleft { border-right: 0px solid #8ecaf9; } + .themeGrey .bright { border-left: 0px solid #8ecaf9; }