feat(experimental): add legend_isolate_on_click option#1061
Open
maxim-yegorov wants to merge 1 commit intoRomRider:devfrom
Open
feat(experimental): add legend_isolate_on_click option#1061maxim-yegorov wants to merge 1 commit intoRomRider:devfrom
maxim-yegorov wants to merge 1 commit intoRomRider:devfrom
Conversation
ApexCharts v5 accesses chart.events.beforeMount directly without null-checking,
causing a TypeError crash in certain configurations (e.g. sections view).
- Always include chart.events: {} in the layout config so ApexCharts never
receives an undefined events object
- Add a post-constructor guard to ensure chart.events is an object before
render() is called
- Patch ApexCharts v5.3.3 ESM to add null-guards on chart.events accesses
(beforeMount, mounted, updated, legendClick) via patch-package
be6fd85 to
595b9da
Compare
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.
Changes
New feature:
legend_isolate_on_clickWhen enabled, clicking a legend item isolates that series (hides all others). Clicking the same item again restores all series.
Requires all series to have unique names (same constraint as
hidden_by_default). The default ApexCharts toggle behavior is disabled when this option is active.Bug fix: TypeError crash in ApexCharts v5 sections view
Fixes
TypeError: Cannot read properties of undefined (reading 'beforeMount')thrown when rendering charts in HA sections view (section_mode: true).Root cause: ApexCharts v5 accesses
chart.events.beforeMountunconditionally, but under certain config merging conditionschart.eventsends upundefined.Fix:
chart.events: {}in the layout configrender()patch-packageto add null-guards onchart.eventsaccesses (beforeMount,mounted,updated,legendClick)Test plan
experimental: { legend_isolate_on_click: true }on a multi-series chartTypeError: beforeMountcrash in sections view (section_mode: true)