Fix history prepend for multi-parameter plots (e.g. drivable target/value) - #89
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On a drivable module's plot (which shows both
valueandtargetseries),shrinking the visible time window and then widening it again only
backfilled history for the
valueseries.targetnever got its olderdata re-prepended.
Root cause
HistoryDB.handle_event("fetch-chart-range", ...)always fetched historyfor a single hardcoded parameter —
socket.assigns.parameter, whichget_parameter/1resolves to whichever parameter is literally named"value". Multi-series plots (e.g.PlotDB.Drivable, whoseparam_names/0returns["value", "target"]) were never accounted for,so
target's series was silently skipped on every range-based backfill.Fix
fetch-chart-rangenow:PlotDB.param_list/1(already used for live-tick updates) instead of the single cached
parameterassign.%Parameter{}struct with anew
resolve_param/2helper (handles both bare%Parameter{}and%Module{}secop objects).all
seriesUpdates(and anyarrayLen) into a single payload viamerge_trace_updates/1before pushing oneprepend-chart-data-#{id}event.
No JS changes needed — the
EChartsCharthook already iterates everyentry in
seriesUpdates, so it transparently picks up the extra series.