refactor: e-charts imperative model#1888
Merged
pedrolamas merged 4 commits intoJun 21, 2026
Merged
Conversation
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors ECharts usage to favor imperative setOption updates (via manual-update) instead of relying on reactive :option binding, and consolidates repeated system chart markup into a shared wrapper component.
Changes:
- Switch
AppChart(andThermalChart) tomanual-updateand explicitly apply options/datasets imperatively. - Introduce
SystemChartwrapper to unify layout/label styling across system charts and remove duplicated “ready” gating logic. - Minor safety hardening around optional chart refs (e.g.,
BedMeshChart).
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/components/widgets/thermals/ThermalChart.vue | Moves to manual-update + imperative option application; adds chart-ready handler and option watcher. |
| src/components/widgets/system/SystemUsageCard.vue | Removes now-relocated chart label styling. |
| src/components/widgets/system/SystemMemoryChart.vue | Switches to shared SystemChart wrapper; removes local ready/watch plumbing. |
| src/components/widgets/system/SystemLoadChart.vue | Switches to SystemChart; simplifies yAxis max logic. |
| src/components/widgets/system/SystemChart.vue | New wrapper component encapsulating common system chart markup + styles + “has data” gating. |
| src/components/widgets/system/MoonrakerLoadChart.vue | Switches to SystemChart; removes local ready/watch plumbing. |
| src/components/widgets/system/McuLoadChart.vue | Switches to SystemChart; removes local ready/watch plumbing. |
| src/components/widgets/system/KlipperLoadChart.vue | Switches to SystemChart; removes local ready/watch plumbing. |
| src/components/widgets/bedmesh/BedMeshChart.vue | Makes chart ref optional and guards chart method calls. |
| src/components/ui/AppChart.vue | Converts to manual-update and applies options/dataset imperatively. |
An empty Moonraker temperature store sets charts.ready with an empty chart array, so ThermalChart could be created with no data and throw in Object.keys(chartData[0]). Build the series only once data has entries, and re-apply once it arrives. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
AppChart and SystemChart validate `data` with `type: Array` and use array semantics, but typed it as `DatasetComponentOption['source']` (which includes a non-array form). Narrow to `Extract<…, unknown[]>` so the type matches the validator and usage. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
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.
Refactor e-charts usage to use imperative changes rather than observable ones.