Fix real-time graph updates: skip inconsistent cases and rescale the Y axis - #3437
Open
Salvialf wants to merge 4 commits into
Open
Fix real-time graph updates: skip inconsistent cases and rescale the Y axis#3437Salvialf wants to merge 4 commits into
Salvialf wants to merge 4 commits into
Conversation
zoic21
approved these changes
Jul 24, 2026
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.
graphUpdatewas adding real-time command values to charts unconditionally, without checking whether the chart was in a state where a raw value would actually make sense.Three cases where this breaks the display:
groupingType, e.g. sum/average per hour or day): the historical series only contains already-aggregated points (computed server-side via SQLGROUP BY). A real-time update inserted a raw instantaneous value in the middle of these aggregates, creating an artificial spike or drop.derive): the historical series shows the difference between consecutive values, also computed server-side. A real-time update inserted the raw absolute value instead of a variation, for the same kind of visual break.This change skips the real-time update entirely for a chart/command combination in any of these three cases, instead of silently corrupting the display. It also means the matching series can safely be found with
.find()and stop at the first match, now that a chart in comparison mode is excluded upfront (previously up to two series could share the same command id, so every series had to be checked).Also merged the two separate
cmd::updateevent listeners (jeedom.cmd.refreshValueandjeedom.history.graphUpdate) into one, found while investigating this.Separately,
graphUpdatenever re-triggers the Y axis scale calculation after adding a real-time point. The axis min/max are computed once, when the chart is first drawn (setAxisScales), and stay fixed after that unless the user manually zooms or resets the view. A new value exceeding the original range was simply invisible, off the top or bottom of the chart. This only affects charts using the default axis scaling mode (yAxisScaling/yAxisByUnitboth enabled, or either one alone); the remaining combination already uses soft bounds that auto-expand. The fix callssetAxisScalesagain after a successful real-time update.Known related issues, not addressed here:
desktop/js/view.jsanddesktop/js/plan.js, and isn't specific tographUpdate.