optimize dataset color and chart hover

Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
Stefan Dej committed 2021-02-22 22:19:43 +01:00
1 parent 389c162878
commit 14195daa5a
4 files changed
+40 -15

No files matched your search

+6 -6
View File
@@ -57,11 +57,11 @@ export default {
if (mainDataset)
output += "<span style=\"" +
"display:inline-block;" +
"margin-right:6px;" +
"width:10px;" +
"height:10px;" +
"border:1px solid "+mainDataset.lineStyle.color+";" +
"background-color:"+mainDataset.lineStyle.color+"66;" +
"margin-right:10px;" +
"width:8px;" +
"height:8px;" +
"border-radius: 50%;" +
"background-color:"+mainDataset.lineStyle.color+"CC;" +
"\"></span>"
output += convertName(dataset.seriesName)+":"
@@ -260,7 +260,7 @@ export default {
methods: {
createChart() {
if (document.getElementById("tempchart") && this.chart === null) {
this.chart = echarts.init(document.getElementById("tempchart"), null, {renderer: 'svg'})
this.chart = echarts.init(document.getElementById("tempchart"), null, {renderer: 'canvas'})
this.chart.setOption(this.chartOptions)
} else setTimeout(() => {
this.createChart()
+6 -6
View File
@@ -12,10 +12,10 @@
}
.datasetColorSymbol {
width: 10px;
height: 10px;
width: 8px;
height: 8px;
border-style: solid;
border-width: 1px;
border-width: 0px;
cursor: pointer;
border-radius: 50%;
}
@@ -90,7 +90,7 @@
</v-col>
<v-col class="py-2 font-weight-bold"><span style="cursor: pointer;" @click="openHeater(heater)">{{ convertName(heater.name) }}</span></v-col>
<v-col class="py-2 flex-grow-0 text-center d-none d-sm-block" v-if="boolTempchart" style="min-width: 70px;">
<div :style="'background-color: '+heater.chartColor+'66; border-color: '+heater.chartColor+';'" class="datasetColorSymbol d-inline-block" @click="openHeater(heater)"></div>
<div :style="'background-color: '+heater.chartColor+'cc;'" class="datasetColorSymbol d-inline-block" @click="openHeater(heater)"></div>
</v-col>
<v-col class="py-2 text-center d-none d-sm-block"><small>{{ heater.target > 0 ? (heater.power !== null ? (heater.power > 0 ? (heater.power * 100).toFixed(0)+'%' : "0%") : "active") : "off" }}</small></v-col>
<v-col class="py-2 text-center">
@@ -110,7 +110,7 @@
</v-col>
<v-col class="py-2 font-weight-bold"><span style="cursor: pointer;" @click="openHeater(fan)">{{ convertName(fan.name) }}</span></v-col>
<v-col class="py-2 flex-grow-0 text-center d-none d-sm-block" v-if="boolTempchart" style="min-width: 70px;">
<div :style="'background-color: '+fan.chartColor+'66; border-color: '+fan.chartColor+';'" class="datasetColorSymbol d-inline-block" @click="openHeater(fan)"></div>
<div :style="'background-color: '+fan.chartColor+'cc;'" class="datasetColorSymbol d-inline-block" @click="openHeater(fan)"></div>
</v-col>
<v-col class="py-2 text-center d-none d-sm-block"><small>{{ fan.target > 0 && fan.speed > 0 ? (fan.speed * 100).toFixed(0)+"%" : (fan.target > 0 ? "standby" : "off") }}</small></v-col>
<v-col class="py-2 text-center">
@@ -132,7 +132,7 @@
<span style="cursor: pointer;" @click="openHeater(sensor)">{{ convertName(sensor.name) }}</span>
</v-col>
<v-col class="py-2 flex-grow-0 text-center d-none d-sm-block" v-if="boolTempchart" style="min-width: 70px;">
<div :style="'background-color: '+sensor.chartColor+'66; border-color: '+sensor.chartColor+';'" class="datasetColorSymbol d-inline-block" @click="openHeater(sensor)"></div>
<div :style="'background-color: '+sensor.chartColor+'CC;'" class="datasetColorSymbol d-inline-block" @click="openHeater(sensor)"></div>
</v-col>
<v-col class="py-2 d-none d-sm-block"><span>&nbsp;</span></v-col>
<v-col class="py-2 text-center">
+27 -2
View File
@@ -43,9 +43,16 @@ export default {
lineStyle: {
color: rootGetters["gui/getDatasetValue"]({ name: name, type: 'color' }) || color,
width: 2,
opacity: (rootGetters["gui/getDatasetValue"]({ name: name, type: 'temperature' })) ? 1 : 0
opacity: (rootGetters["gui/getDatasetValue"]({ name: name, type: 'temperature' })) ? 0.9 : 0
},
symbol: 'none',
emphasis: {
lineStyle: {
color: rootGetters["gui/getDatasetValue"]({ name: name, type: 'color' }) || color,
width: 2,
opacity: (rootGetters["gui/getDatasetValue"]({ name: name, type: 'temperature' })) ? 0.9 : 0
}
},
data: [],
}
@@ -74,6 +81,16 @@ export default {
color: datasetTemperature.lineStyle.color,
opacity: (rootGetters["gui/getDatasetValue"]({ name: name, type: 'target' })) ? 0.1 : 0
},
emphasis: {
lineStyle: {
color: datasetTemperature.lineStyle.color,
width: 0,
},
areaStyle: {
color: datasetTemperature.lineStyle.color,
opacity: (rootGetters["gui/getDatasetValue"]({ name: name, type: 'target' })) ? 0.1 : 0
},
},
symbol: 'none',
data: [],
}
@@ -102,7 +119,15 @@ export default {
color: datasetTemperature.lineStyle.color,
width: 1,
type: 'dotted',
opacity: (rootGetters["gui/getDatasetValue"]({ name: name, type: additionalType })) ? 1 : 0
opacity: (rootGetters["gui/getDatasetValue"]({ name: name, type: additionalType })) ? 0.9 : 0
},
emphasis: {
lineStyle: {
color: datasetTemperature.lineStyle.color,
width: 1,
type: 'dotted',
opacity: (rootGetters["gui/getDatasetValue"]({ name: name, type: additionalType })) ? 0.9 : 0
},
},
symbol: 'none',
data: [],
+1 -1
View File
@@ -59,7 +59,7 @@ export default {
if (payload.type === "target" && 'areaStyle' in state.series[datasetIndex]) {
Vue.set(state.series[datasetIndex].areaStyle, 'opacity', payload.value ? 0.1 : 0)
} else if ('lineStyle' in state.series[datasetIndex]) {
Vue.set(state.series[datasetIndex].lineStyle, 'opacity', payload.value)
Vue.set(state.series[datasetIndex].lineStyle, 'opacity', payload.value ? 0.9 : 0)
}
}
},