v0.04 Fix reset

This commit is contained in:
T__o 2020-04-30 19:04:06 +02:00
parent 2aa8293849
commit 458b5c45b7
6 changed files with 35 additions and 34 deletions

View File

@ -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)

View File

@ -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

2
doc.md
View File

@ -3,6 +3,8 @@
# Changelog
v0.04 Fix reset
v0.03 maths functions
v0.02 sync x axis
v0.01 repack, data auto loading

View File

@ -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;
}

View File

@ -88,7 +88,7 @@
<v-list-item>
<v-list-item-action>
Maths
<b>Maths Functions</b>
</v-list-item-action>
</v-list-item>

View File

@ -1,7 +1,7 @@
<template>
<div :class="'counter '+ classname">
<button @click="click(-1)" class="bleft">-</button>
<span>{{value}}</span>
<span>{{input}}</span>
<button @click="click(1)" class="bright">+</button>
</div>
</template>
@ -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)
}
},
}
</script>
@ -51,9 +49,11 @@
border: 0px solid red;
border-radius: 5px;
}
.bleft {
margin-right: 3px;
}
.bright {
margin-left: 3px;
}
@ -63,12 +63,15 @@
background: #d3e3e0;
color: white;
}
.themeGreen.counter button {
background: #d3e3e0;
}
.themeGreen .bleft {
border-right: 1px solid #2c3e50;
}
.themeGreen .bright {
border-left: 1px solid #2c3e50;
}
@ -78,14 +81,17 @@
background: inherit;
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;
}