diff --git a/src/components/charts/TempChart.vue b/src/components/charts/TempChart.vue
index bb4c994a5..50619df51 100644
--- a/src/components/charts/TempChart.vue
+++ b/src/components/charts/TempChart.vue
@@ -14,11 +14,12 @@ import { convertName } from '@/plugins/helpers'
import Component from 'vue-class-component'
import { Mixins, Watch } from 'vue-property-decorator'
import BaseMixin from '../mixins/base'
-import { PrinterTempHistoryStateSerie, PrinterTempHistoryStateSourceEntry } from '@/store/printer/tempHistory/types'
+import { PrinterTempHistoryStateSourceEntry } from '@/store/printer/tempHistory/types'
import type { ECharts } from 'echarts/core'
import type { ECBasicOption } from 'echarts/types/dist/shared.d'
import { mdiClock } from '@mdi/js'
+import { datasetTypesInPercents } from '@/store/variables'
interface echartsTooltipObj {
[key: string]: any
@@ -33,11 +34,48 @@ export default class TempChart extends Mixins(BaseMixin) {
}
private isVisible = true
- public chartOptions: ECBasicOption = {
- darkMode: true,
- renderer: 'svg',
- animation: false,
- tooltip: {
+ get chartOptions(): ECBasicOption {
+ return {
+ darkMode: true,
+ renderer: 'svg',
+ animation: false,
+ tooltip: this.tooltip,
+ grid: {
+ top: 35,
+ right: this.gridRight,
+ bottom: 30,
+ left: 25,
+ },
+ legend: {
+ animation: false,
+ show: false,
+ selected: this.selectedLegends,
+ },
+ xAxis: {
+ type: 'time',
+ splitNumber: 5,
+ minInterval: 60 * 1000,
+ splitLine: {
+ show: true,
+ lineStyle: {
+ color: 'rgba(255, 255, 255, 0.06)',
+ },
+ },
+ axisLabel: {
+ color: 'rgba(255, 255, 255, 0.24)',
+ margin: 10,
+ formatter: this.timeFormat,
+ },
+ },
+ yAxis: this.yAxis,
+ media: this.media,
+ dataset: { source: this.source },
+ series: this.series,
+ }
+ }
+
+ get tooltip() {
+ return {
animation: false,
trigger: 'axis',
backgroundColor: 'rgba(0,0,0,0.9)',
@@ -57,38 +95,11 @@ export default class TempChart extends Mixins(BaseMixin) {
obj[['left', 'right'][+(pos[0] < size.viewSize[0] / 2)]] = 5
return obj
},
- },
- grid: {
- top: 35,
- right: 15,
- bottom: 30,
- left: 25,
- },
- legend: {
- animation: false,
- show: false,
- selected: {},
- },
- /*dataZoom: [{
- type: 'inside',
- }],*/
- xAxis: {
- type: 'time',
- splitNumber: 5,
- minInterval: 60 * 1000,
- splitLine: {
- show: true,
- lineStyle: {
- color: 'rgba(255, 255, 255, 0.06)',
- },
- },
- axisLabel: {
- color: 'rgba(255, 255, 255, 0.24)',
- margin: 10,
- formatter: this.timeFormat,
- },
- },
- yAxis: [
+ }
+ }
+
+ get yAxis() {
+ return [
{
name: this.$t('Panels.TemperaturePanel.TemperaturesInChart'),
type: 'value',
@@ -158,15 +169,18 @@ export default class TempChart extends Mixins(BaseMixin) {
},
},
},
- ],
- media: [
+ ]
+ }
+
+ get media() {
+ return [
{
query: {
minWidth: 500,
},
option: {
grid: {
- right: 15,
+ right: this.optionGridRight,
left: 40,
},
yAxis: [
@@ -188,11 +202,7 @@ export default class TempChart extends Mixins(BaseMixin) {
],
},
},
- ],
- dataset: {
- source: [],
- },
- series: [],
+ ]
}
get chart(): ECharts | null {
@@ -241,85 +251,32 @@ export default class TempChart extends Mixins(BaseMixin) {
}
}
- mounted() {
- this.initChart()
- this.chartOptions.xAxis.axisLabel.formatter = this.timeFormat
+ get gridRight() {
+ return this.boolDisplayPwmAxis ? 25 : 15
}
- beforeDestroy() {
- if (typeof window === 'undefined') return
- if (this.chart) this.chart.dispose()
- }
-
- initChart() {
- this.chartOptions.series = this.series
- this.chartOptions.legend.selected = this.selectedLegends
- this.updateChartPwmAxis()
- }
-
- updateChart() {
- if (this.chart && this.isVisible) {
- //const t0 = performance.now()
- const limitDate = new Date(Date.now() - this.maxHistory * 1000)
- let newSource = [...this.source].filter((entry: PrinterTempHistoryStateSourceEntry) => {
- return entry.date >= limitDate
- })
-
- this.chart?.setOption(
- {
- dataset: {
- source: newSource,
- },
- },
- false,
- true
- )
+ get optionGridRight() {
+ if (this.boolDisplayPwmAxis) return 35
- //const t1 = performance.now()
- //window.console.debug('calc chart', (t1-t0).toFixed(), newSource.length, this.source.length)
-
- // reset tempHistory if working sources are smaller than 80%
- if (this.source.length > 0 && newSource.length < this.maxHistory * 0.8) {
- this.$socket.emit('server.temperature_store', {}, { action: 'printer/tempHistory/init' })
- }
- }
+ return 15
}
- updateChartPwmAxis() {
- if (this.boolDisplayPwmAxis) {
- this.chartOptions.yAxis[1].show = true
- this.chartOptions.grid.right = 25
- this.chartOptions.media[0].option.grid.right = 35
- } else {
- this.chartOptions.yAxis[1].show = false
- this.chartOptions.grid.right = 15
- this.chartOptions.media[0].option.grid.right = 15
- }
+ beforeDestroy() {
+ if (typeof window === 'undefined') return
+ if (this.chart) this.chart.dispose()
}
visibilityChanged(isVisible: boolean) {
this.isVisible = isVisible
-
- if (isVisible) {
- this.initChart()
- }
}
tooltipFormatter(datasets: any) {
let output = ''
- const mainDatasets = datasets.filter((dataset: any) => {
- if (dataset.seriesName === 'date') return false
-
- const lastIndex = dataset.seriesName.lastIndexOf('-')
- if (lastIndex === -1) return true
-
- const suffix = dataset.seriesName.slice(lastIndex + 1)
- return !['target', 'power', 'speed'].includes(suffix)
- })
+ const mainDatasets = datasets.filter((dataset: any) => dataset.seriesName.endsWith('-temperature'))
if (datasets.length) {
let outputTime = datasets[0]['axisValueLabel']
- outputTime = outputTime.substr(outputTime.indexOf(' '))
+ outputTime = outputTime.substring(outputTime.indexOf(' '))
output +=
'
' +
@@ -338,24 +295,35 @@ export default class TempChart extends Mixins(BaseMixin) {
}
mainDatasets.forEach((dataset: any) => {
+ const baseSeriesName = dataset.seriesName.substring(0, dataset.seriesName.lastIndexOf('-'))
+ let displayName = baseSeriesName
+ if (displayName.indexOf(' ') !== -1) {
+ displayName = displayName.substring(displayName.indexOf(' ') + 1)
+ }
+
output += '
'
output += '
'
output += dataset.marker
- output += "" + convertName(dataset.seriesName) + ':'
+ output += "" + convertName(displayName) + ':'
output += '
'
output += '
'
- if (dataset.seriesName in dataset.value) output += dataset.value[dataset.seriesName].toFixed(1)
- if (dataset.seriesName + '-target' in dataset.value)
- output += ' / ' + dataset.value[dataset.seriesName + '-target'].toFixed(1)
+ const seriesNameTemperature = `${baseSeriesName}-temperature`
+ const seriesNameTarget = `${baseSeriesName}-target`
+
+ if (seriesNameTemperature in dataset.value) output += dataset.value[seriesNameTemperature].toFixed(1)
+ if (seriesNameTarget in dataset.value) output += ' / ' + dataset.value[seriesNameTarget].toFixed(1)
output += '°C'
- if (dataset.seriesName + '-power' in dataset.value)
- output += ' [ ' + (dataset.value[dataset.seriesName + '-power'] * 100).toFixed(0) + '% ]'
- if (dataset.seriesName + '-speed' in dataset.value)
- output += ' [ ' + (dataset.value[dataset.seriesName + '-speed'] * 100).toFixed(0) + '% ]'
+ datasetTypesInPercents.forEach((attrKey) => {
+ const seriesName = `${baseSeriesName}-${attrKey}`
+ if (!(seriesName in dataset.value)) return
+
+ const value = (dataset.value[seriesName] * 100).toFixed(0)
+ output += ` [ ${value}% ]`
+ })
output += '
'
output += '
'
@@ -364,26 +332,6 @@ export default class TempChart extends Mixins(BaseMixin) {
return output
}
- @Watch('series', { deep: true })
- seriesChanged(newVal: PrinterTempHistoryStateSerie[]) {
- if (this.chart && this.chart?.isDisposed() !== true) {
- this.chart.setOption(
- {
- series: newVal,
- },
- false,
- true
- )
- }
- }
-
- @Watch('source')
- sourceChanged() {
- if (this.chart?.isDisposed() !== true) {
- this.updateChart()
- }
- }
-
@Watch('selectedLegends')
selectedLegendsChanged(newVal: any, oldVal: any) {
if (this.chart?.isDisposed() !== true) {
@@ -396,14 +344,20 @@ export default class TempChart extends Mixins(BaseMixin) {
}
}
- @Watch('boolDisplayPwmAxis')
- boolDisplayPwmAxisChanged() {
- this.updateChartPwmAxis()
- }
+ @Watch('source')
+ sourceChanged(newVal: PrinterTempHistoryStateSourceEntry[]) {
+ // break if chart isn't initialized or not visible
+ if (!this.chart || !this.isVisible) return
+
+ const limitDate = new Date(Date.now() - this.maxHistory * 1000)
+ let newSource = newVal.filter((entry: PrinterTempHistoryStateSourceEntry) => {
+ return entry.date >= limitDate
+ })
- @Watch('hours12Format')
- hours12FormatChanged() {
- this.chartOptions.xAxis.axisLabel.formatter = this.timeFormat
+ // reset tempHistory if working sources are smaller than 80%
+ if (newVal.length > 0 && newSource.length < this.maxHistory * 0.8) {
+ this.$socket.emit('server.temperature_store', {}, { action: 'printer/tempHistory/init' })
+ }
}
}
diff --git a/src/components/panels/Temperature/TemperaturePanelList.vue b/src/components/panels/Temperature/TemperaturePanelList.vue
new file mode 100644
index 000000000..837feb0f9
--- /dev/null
+++ b/src/components/panels/Temperature/TemperaturePanelList.vue
@@ -0,0 +1,137 @@
+
+
+
+
+
+
+ |
+ {{ $t('Panels.TemperaturePanel.Name') }} |
+
+ {{ $t('Panels.TemperaturePanel.State') }}
+ |
+
+ {{ $t('Panels.TemperaturePanel.Current') }}
+ |
+
+ {{ $t('Panels.TemperaturePanel.Target') }}
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/panels/Temperature/TemperaturePanelListItem.vue b/src/components/panels/Temperature/TemperaturePanelListItem.vue
new file mode 100644
index 000000000..ca7c16542
--- /dev/null
+++ b/src/components/panels/Temperature/TemperaturePanelListItem.vue
@@ -0,0 +1,274 @@
+
+
+
+
+ {{ icon }}
+
+ |
+
+ {{ formatName }}
+ |
+
+
+
+ {{ formatState }}
+
+ {{ $t('Panels.TemperaturePanel.Avg') }}: {{ avgState }} %
+
+ |
+
+
+
+
+ {{ formatTemperature }}
+
+
+
+ {{ $t('Panels.TemperaturePanel.Max') }}: {{ measured_max_temp }}°C
+
+ {{ $t('Panels.TemperaturePanel.Min') }}: {{ measured_min_temp }}°C
+
+
+
+ {{ rpm }} RPM
+
+
+ |
+
+
+ |
+
+
+
+
+
+
+
diff --git a/src/components/panels/Temperature/TemperaturePanelListItemAdditionalSensor.vue b/src/components/panels/Temperature/TemperaturePanelListItemAdditionalSensor.vue
new file mode 100644
index 000000000..40f1afd7e
--- /dev/null
+++ b/src/components/panels/Temperature/TemperaturePanelListItemAdditionalSensor.vue
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
diff --git a/src/components/panels/Temperature/TemperaturePanelListItemAdditionalSensorValue.vue b/src/components/panels/Temperature/TemperaturePanelListItemAdditionalSensorValue.vue
new file mode 100644
index 000000000..aadc033b1
--- /dev/null
+++ b/src/components/panels/Temperature/TemperaturePanelListItemAdditionalSensorValue.vue
@@ -0,0 +1,70 @@
+
+
+ {{ formatValue }}
+
+
+
+
diff --git a/src/components/panels/Temperature/TemperaturePanelListItemEdit.vue b/src/components/panels/Temperature/TemperaturePanelListItemEdit.vue
new file mode 100644
index 000000000..275c26c8e
--- /dev/null
+++ b/src/components/panels/Temperature/TemperaturePanelListItemEdit.vue
@@ -0,0 +1,90 @@
+
+
+
+
+
+ {{ mdiCloseThick }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/panels/Temperature/TemperaturePanelListItemEditAdditionalSensor.vue b/src/components/panels/Temperature/TemperaturePanelListItemEditAdditionalSensor.vue
new file mode 100644
index 000000000..1c9d110bd
--- /dev/null
+++ b/src/components/panels/Temperature/TemperaturePanelListItemEditAdditionalSensor.vue
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/components/panels/Temperature/TemperaturePanelListItemEditChartSerie.vue b/src/components/panels/Temperature/TemperaturePanelListItemEditChartSerie.vue
new file mode 100644
index 000000000..ddfbea12f
--- /dev/null
+++ b/src/components/panels/Temperature/TemperaturePanelListItemEditChartSerie.vue
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/components/panels/Temperature/TemperaturePanelPresets.vue b/src/components/panels/Temperature/TemperaturePanelPresets.vue
new file mode 100644
index 000000000..f434e89cd
--- /dev/null
+++ b/src/components/panels/Temperature/TemperaturePanelPresets.vue
@@ -0,0 +1,113 @@
+
+
+
+
+
+ {{ $t('Panels.TemperaturePanel.Presets') }}
+ {{ mdiFire }}
+ {{ mdiMenuDown }}
+
+
+
+
+
+ {{ mdiFire }}
+ {{ preset.name }}
+
+
+
+
+
+
+
+ {{ mdiSnowflake }}
+ {{ $t('Panels.TemperaturePanel.Cooldown') }}
+
+
+
+
+
+ {{ mdiSnowflake }}
+ {{ $t('Panels.TemperaturePanel.Cooldown') }}
+
+
+
+
+
+
+
diff --git a/src/components/panels/Temperature/TemperaturePanelSettings.vue b/src/components/panels/Temperature/TemperaturePanelSettings.vue
new file mode 100644
index 000000000..ad9cfc8a8
--- /dev/null
+++ b/src/components/panels/Temperature/TemperaturePanelSettings.vue
@@ -0,0 +1,53 @@
+
+
+
+
+ {{ mdiCog }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/panels/TemperaturePanel.vue b/src/components/panels/TemperaturePanel.vue
index 50d4702e0..4acf4e9e8 100644
--- a/src/components/panels/TemperaturePanel.vue
+++ b/src/components/panels/TemperaturePanel.vue
@@ -1,433 +1,49 @@
-
-
-
-
-
-
-
- {{ $t('Panels.TemperaturePanel.Presets') }}
- {{ mdiFire }}
- {{ mdiMenuDown }}
-
-
-
-
-
- {{ mdiFire }}
- {{ preset.name }}
-
-
-
-
-
-
-
- {{ mdiSnowflake }}
- {{ $t('Panels.TemperaturePanel.Cooldown') }}
-
-
-
-
-
- {{ mdiSnowflake }}
- {{ $t('Panels.TemperaturePanel.Cooldown') }}
-
-
-
-
- {{ mdiCog }}
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
- |
- {{ $t('Panels.TemperaturePanel.Name') }} |
-
- {{ $t('Panels.TemperaturePanel.State') }}
- |
-
- {{ $t('Panels.TemperaturePanel.Current') }}
- |
-
- {{ $t('Panels.TemperaturePanel.Target') }}
- |
-
-
-
-
-
-
- {{ object.icon }}
-
- |
-
-
- {{ convertName(object.name) }}
-
- |
-
-
-
-
- {{ object.state }}
-
-
- {{ $t('Panels.TemperaturePanel.Avg') }}: {{ object.avgState }}
-
- |
-
-
-
-
- {{ object.temperature.toFixed(1) }}°C
-
-
-
- {{ $t('Panels.TemperaturePanel.Max') }}:
- {{ object.measured_max_temp }}°C
-
- {{ $t('Panels.TemperaturePanel.Min') }}:
- {{ object.measured_min_temp }}°C
-
-
-
-
- {{ values.value }} {{ values.unit }}
-
-
-
- {{ object.rpm }} RPM
-
- |
-
-
- |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ mdiCloseThick }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
diff --git a/src/components/ui/Panel.vue b/src/components/ui/Panel.vue
index 15f6284f9..e54c3b40f 100644
--- a/src/components/ui/Panel.vue
+++ b/src/components/ui/Panel.vue
@@ -96,6 +96,15 @@ export default class Panel extends Mixins(BaseMixin) {
.icon-rotate-90 {
transform: rotate(90deg);
}
+
+.panel-toolbar {
+ overflow-y: hidden;
+}
+
+::v-deep .panel-toolbar .v-btn {
+ height: 100% !important;
+ max-height: none;
+}