fix: preserve BarChart axis and colors when switching to stacked100#3310
Open
rajanpanth wants to merge 1 commit into
Open
fix: preserve BarChart axis and colors when switching to stacked100#3310rajanpanth wants to merge 1 commit into
rajanpanth wants to merge 1 commit into
Conversation
rajanpanth
requested a deployment
to
Approval required to run action on external PR
July 21, 2026 16:25 — with
GitHub Actions
Waiting
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.
Description
Fix BarChart updates when the
typeprop changes dynamically betweenstackedandstacked100.Previously,
BarChartderived itsstacked100normalization flag only during component initialization. A latertypeupdate reached the bar series but left the core chart using the previous normalization mode. Enteringstacked100therefore retained raw values, while leaving it retained normalized fractions, producing incorrect axis semantics and an apparent series-color collapse even though the series identities and palette remained intact.Changes
stacked100reactively fromtypestacked100rendering@evidence-dev/core-componentsTesting
pnpm --filter ./packages/ui/core-components test:unit --run src/lib/unsorted/viz/bar/BarChart.spec.js— 4 passedpnpm --filter ./packages/ui/core-components test:unit --run— 121 passed, 3 pre-existing skippedpnpm --filter ./packages/ui/core-components build— passed, includingsvelte-packageandpublintpnpm changeset status --since=origin/main— passedgit diff --check— passedThe package-wide Svelte check remains blocked by existing diagnostics in unchanged files. The aggregate lint command is also blocked by the current Prettier/YAML baseline; every changed file passes focused formatting and ESLint validation.
Before
Dynamic transitions could leave the chart data normalization and axis formatting in the previous stacked mode.
After
Normalized data, raw data, axis formatting, series identity, and distinct palette colors consistently match the active chart type across forward, reverse, and repeated transitions.
Screenshots
No screenshot is included. The existing Storybook environment fails before rendering BarChart stories with a pre-existing
fromStorybookruntime error; the behavior is covered deterministically at the generated ECharts configuration boundary.Related issue
Fixes #3299
Compatibility
No public API change. Initial rendering and unrelated chart types remain unchanged. The runtime addition is one reactive boolean comparison when
typechanges.