Skip to content

Commit

Permalink
fix(tempchart): fix select/unselect monitor sensors in tempchart (#1903)
Browse files Browse the repository at this point in the history
  • Loading branch information
meteyou authored Jun 23, 2024
1 parent b5599ef commit f0fe3e9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 19 deletions.
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"codemirror": "^6.0.1",
"core-js": "^3.16.0",
"detect-browser": "^5.3.0",
"echarts": "^5.2.2",
"echarts": "^5.5.0",
"echarts-gl": "^2.0.8",
"hls.js": "^1.3.3",
"jmuxer": "^2.0.5",
Expand Down
11 changes: 2 additions & 9 deletions src/components/charts/TempChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -347,15 +347,8 @@ export default class TempChart extends Mixins(BaseMixin, ThemeMixin) {
}
@Watch('selectedLegends')
selectedLegendsChanged(newVal: any, oldVal: any) {
if (this.chart?.isDisposed() !== true) {
Object.keys(newVal).forEach((key) => {
if (newVal[key] !== oldVal[key]) {
const actionType = newVal[key] ? 'legendSelect' : 'legendUnSelect'
this.chart?.dispatchAction({ type: actionType, name: key })
}
})
}
selectedLegendsChanged(newVal: any) {
if (this.chart?.isDisposed() !== true) this.chart?.setOption({ legend: { selected: newVal } })
}
@Watch('source')
Expand Down
3 changes: 2 additions & 1 deletion src/store/printer/tempHistory/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,12 @@ export const getters: GetterTree<PrinterTempHistoryState, RootState> = {

const selected: legends = {}
const available_sensors = rootState.printer?.heaters?.available_sensors ?? []
const available_monitors = rootState.printer?.heaters?.available_monitors ?? []
const viewSettings = rootState.gui?.view?.tempchart?.datasetSettings ?? {}

Object.keys(viewSettings).forEach((key) => {
// break if this element doesn't exist in available_sensors
if (!available_sensors.includes(key)) return
if (!available_sensors.includes(key) && !available_monitors.includes(key)) return

Object.keys(viewSettings[key]).forEach((attrKey) => {
// break if this element isn't a valid datasetType
Expand Down

0 comments on commit f0fe3e9

Please sign in to comment.