Skip to content

Commit

Permalink
fix: timeseries labels not correctly updated after default unit setti…
Browse files Browse the repository at this point in the history
…ngs change (#376)
  • Loading branch information
claustres committed Oct 25, 2024
1 parent 8a60191 commit fc47db0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/components/MapActivity.vue
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,10 @@ export default {
this.$engineEvents.on('moveend', this.onMoveEnd)
this.$engineEvents.on('forecast-model-changed', this.updateSelection)
this.$engineEvents.on('selected-level-changed', this.updateSelection)
this.$events.on('timeseries-group-by-changed', this.updateTimeSeries)
// We use debounce here to avoid multiple refresh when editing settings for instance
this.requestTimeSeriesUpdate = _.debounce(this.updateTimeSeries, 250)
this.$events.on('timeseries-group-by-changed', this.requestTimeSeriesUpdate)
this.$events.on('units-changed', this.requestTimeSeriesUpdate)
this.$events.on('time-current-time-changed', this.updateProbedLocationHighlight)
},
beforeUnmount () {
Expand All @@ -334,7 +337,8 @@ export default {
this.$engineEvents.off('forecast-model-changed', this.updateSelection)
this.$engineEvents.off('selected-level-changed', this.updateSelection)
this.$events.off('timeseries-group-by-changed', this.updateTimeSeries)
this.$events.off('time-current-time-changed', this.updateProbedLocationHighlight)
this.$events.off('units-changed', this.requestTimeSeriesUpdate)
this.$events.off('time-current-time-changed', this.requestTimeSeriesUpdate)
this.unregisterStyle('point', this.getHighlightMarker)
this.unregisterStyle('tooltip', this.getHighlightTooltip)
},
Expand Down
4 changes: 2 additions & 2 deletions src/components/TimeSeries.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const isSelectorVisible = computed(() => {
return visible && !hasSingleSerie.value
})
// Watch change in time series driavers like time range, format, ...
// Watch change in time series drivers like time range, format, ...
watch(Store.get('time.range'), async () => {
if (chartRef.value) {
// Reset any zoom
Expand Down Expand Up @@ -125,7 +125,7 @@ async function fetchData () {
}
function updateChart () {
if (!chartRef.value) return
chartRef.value.update()
chartRef.value.requestUpdate()
}
function isPinned (timeSerie) {
timeSerie = _.find(state.timeSeries, { id: timeSerie.id })
Expand Down
1 change: 1 addition & 0 deletions src/utils/utils.time-series.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export function getChartOptions (title) {
export async function updateTimeSeries (previousTimeSeries) {
const { CurrentActivity, hasSelectedItems, getSelectedItems, hasProbedLocation, getProbedLocation } = kMapComposables.useCurrentActivity()
const activity = unref(CurrentActivity)
if (!activity) return
// Initialize the time range
const span = Store.get('timeseries.span')
const start = moment(Time.getCurrentTime()).subtract(span, 'm')
Expand Down

0 comments on commit fc47db0

Please sign in to comment.