From 14195daa5a7bfd1173de856812f30438f67e04da Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Mon, 22 Feb 2021 22:19:43 +0100 Subject: [PATCH] optimize dataset color and chart hover Signed-off-by: Stefan Dej --- src/components/charts/TempChart.vue | 12 ++++----- src/components/panels/ToolsPanel.vue | 12 ++++----- src/store/printer/tempHistory/actions.js | 29 ++++++++++++++++++++-- src/store/printer/tempHistory/mutations.js | 2 +- 4 files changed, 40 insertions(+), 15 deletions(-) diff --git a/src/components/charts/TempChart.vue b/src/components/charts/TempChart.vue index 245e3e85..e9ae9a4e 100644 --- a/src/components/charts/TempChart.vue +++ b/src/components/charts/TempChart.vue @@ -57,11 +57,11 @@ export default { if (mainDataset) output += "" 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() diff --git a/src/components/panels/ToolsPanel.vue b/src/components/panels/ToolsPanel.vue index 44972270..1afd75a8 100644 --- a/src/components/panels/ToolsPanel.vue +++ b/src/components/panels/ToolsPanel.vue @@ -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 @@ {{ convertName(heater.name) }} -
+
{{ heater.target > 0 ? (heater.power !== null ? (heater.power > 0 ? (heater.power * 100).toFixed(0)+'%' : "0%") : "active") : "off" }} @@ -110,7 +110,7 @@ {{ convertName(fan.name) }} -
+
{{ fan.target > 0 && fan.speed > 0 ? (fan.speed * 100).toFixed(0)+"%" : (fan.target > 0 ? "standby" : "off") }} @@ -132,7 +132,7 @@ {{ convertName(sensor.name) }} -
+
  diff --git a/src/store/printer/tempHistory/actions.js b/src/store/printer/tempHistory/actions.js index 990dfffb..ec58701e 100644 --- a/src/store/printer/tempHistory/actions.js +++ b/src/store/printer/tempHistory/actions.js @@ -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: [], diff --git a/src/store/printer/tempHistory/mutations.js b/src/store/printer/tempHistory/mutations.js index 453958f9..d47cd021 100644 --- a/src/store/printer/tempHistory/mutations.js +++ b/src/store/printer/tempHistory/mutations.js @@ -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) } } },