Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ui/src/store/data.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ const state = () => ({
})

const mutations = {
deleteMessages (state, data) {
const widgetId = data.widgetId
delete state.messages[widgetId]
},
bind (state, data) {
const widgetId = data.widgetId
// if packet contains a msg, then we process it
Expand Down
12 changes: 11 additions & 1 deletion ui/src/widgets/ui-chart/UIChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -383,10 +383,13 @@
if (Array.isArray(msg.payload) && !msg.payload.length) {
// clear the chart if msg.payload = [] is received
this.clearChart()
this.clearDataStore()
} else {
if (msg.action === 'replace' || (this.props.action === 'replace' && msg.action !== 'append')) {
// clear the chart
this.clearChart()
// delete messages array in the store
this.clearDataStore()
}
// update the chart
this.add(msg)
Expand Down Expand Up @@ -422,6 +425,9 @@
}
return xDisplayFormats
},
clearDataStore () {
this.$store.commit('data/deleteMessages', { widgetId: this.id })
},
clearChart () {
const option = this.chart.getOption()
if (this.props.xAxisType === 'radial') {
Expand All @@ -439,7 +445,11 @@
labels: [],
bins: []
}
this.chart.setOption(option, true)
this.chart.setOption(option, {
notMerge: true, // don't merge with existing option
lazyUpdate: true, // lazy update true means it won't animate
silent: true // don't trigger events
})
this.hasData = false
},
/**
Expand Down Expand Up @@ -686,10 +696,10 @@
updateYAxisLimits (options) {
if (this.hasData && this.props.xAxisType !== 'radial') {
if (!Object.hasOwn(this.props, 'ymin') || this.props.ymin === '' || typeof this.props.ymin === 'undefined') {
options.yAxis[0].min = axisHelper.getAxisMin // set sensible y-limits

Check warning on line 699 in ui/src/widgets/ui-chart/UIChart.vue

View workflow job for this annotation

GitHub Actions / build / Build on 20

Caution: `axisHelper` also has a named export `getAxisMin`. Check if you meant to write `import {getAxisMin} from './helpers/axis.helper'` instead
}
if (!Object.hasOwn(this.props, 'ymax') || this.props.ymax === '' || typeof this.props.ymax === 'undefined') {
options.yAxis[0].max = axisHelper.getAxisMax // set sensible y-limits

Check warning on line 702 in ui/src/widgets/ui-chart/UIChart.vue

View workflow job for this annotation

GitHub Actions / build / Build on 20

Caution: `axisHelper` also has a named export `getAxisMax`. Check if you meant to write `import {getAxisMax} from './helpers/axis.helper'` instead
}
}
},
Expand Down
Loading