fix(dataZoom): keep toolbox zoom from dropping stacked areas#21600
fix(dataZoom): keep toolbox zoom from dropping stacked areas#21600
Conversation
Toolbox dataZoom injects select dataZoom components for both axes. When the value axis is scaled, its window is derived from the stacked coordinate extent, but filtering still used the original value dimension, so stacked area series could be filtered away before render. Reuse the axis extent dimension selection so dataZoom filters stacked series by their rendered stack result dimension. Constraint: toolbox dataZoom creates internal value-axis filters even before users actively zoom. Rejected: Force toolbox dataZoom to filterMode empty | changes existing dataZoom semantics and revives an older workaround. Confidence: high Scope-risk: narrow Directive: Keep dataZoom filtering dimensions aligned with axis extent calculation for stacked data. Tested: ./node_modules/.bin/jest --config test/ut/jest.config.cjs --coverage=false test/ut/spec/component/dataZoom --runInBand Tested: npm run checktype Tested: ./node_modules/.bin/eslint src/component/dataZoom/AxisProxy.ts test/ut/spec/component/dataZoom/AxisProxy.test.ts Tested: git diff --check -- src/component/dataZoom/AxisProxy.ts test/toolbox-dataZoom-stack-area.html test/ut/spec/component/dataZoom/AxisProxy.test.ts Tested: Chrome headless screenshot of test/toolbox-dataZoom-stack-area.html Not-tested: npm run checkheader fails on pre-existing unrelated files missing headers.
|
Thanks for your contribution! The pull request is marked to be To reviewers: If this PR is going to be described in the changelog in the future release, please make sure this PR has one of the following labels: This message is shown because the PR description doesn't contain the document related template. |
There was a problem hiding this comment.
Pull request overview
This PR fixes a stacked-series regression in dataZoom filtering: toolbox-injected dataZoom.select components were computing value-axis windows from stacked extents but still filtering against raw value dimensions, which could remove stacked areas before render. The change aligns AxisProxy filtering with the same axis-dimension helper already used by extent calculation and adds regression coverage around the reported toolbox scenario.
Changes:
- Reuse
getDataDimensionsOnAxisinAxisProxyso dataZoom filtering follows stacked render dimensions. - Add a focused unit regression for toolbox-enabled stacked line data on a scaled value axis.
- Add a manual HTML visual case reproducing the stacked confidence-band scenario from the bug report.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/component/dataZoom/AxisProxy.ts |
Switches axis-dimension selection in dataZoom filtering to the shared helper used by axis extent calculation. |
test/ut/spec/component/dataZoom/AxisProxy.test.ts |
Adds a unit regression that verifies stacked line data is preserved when toolbox dataZoom injects value-axis filtering. |
test/toolbox-dataZoom-stack-area.html |
Adds a manual visual reproduction for toolbox dataZoom with a stacked area/confidence band. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
The changes brought by this PR can be previewed at: https://echarts.apache.org/examples/editor?version=PR-21600@7d0292f |
Copilot noted that the AxisProxy change touches weakFilter and raised concern about empty mode. Add focused coverage for both paths so the stacked-dimension filtering contract is explicit. Constraint: toolbox dataZoom exposes filterMode and may inject value-axis filters before user zoom actions. Rejected: Revert empty mode to raw axis dimensions | tests show stackResultDimension is the rendered value and should be emptied directly. Confidence: high Scope-risk: narrow Directive: Keep weakFilter and empty coverage when changing stacked dataZoom dimensions. Tested: ./node_modules/.bin/jest --config test/ut/jest.config.cjs --coverage=false test/ut/spec/component/dataZoom --runInBand Tested: npm run checktype Tested: ./node_modules/.bin/eslint test/ut/spec/component/dataZoom/AxisProxy.test.ts Tested: git diff --check -- test/ut/spec/component/dataZoom/AxisProxy.test.ts Not-tested: npm run checkheader not rerun for this test-only follow-up; previous run failed on pre-existing unrelated files.
Copilot suggested using raw axis dimensions for empty mode. A temporary verification showed that change turns raw y values for in-window stacked points into NaN, even though their stack result remains visible. Preserve the current implementation and cover that invariant explicitly. Constraint: mapDimensionsAll(axisDim) includes both raw value and stack result dimensions for stacked series. Rejected: Apply Copilot empty-mode suggestion | it corrupts raw values for in-window stacked points. Confidence: high Scope-risk: narrow Directive: Do not special-case empty mode to mapDimensionsAll without preserving raw stacked values. Tested: ./node_modules/.bin/jest --config test/ut/jest.config.cjs --coverage=false test/ut/spec/component/dataZoom --runInBand Tested: npm run checktype Tested: ./node_modules/.bin/eslint test/ut/spec/component/dataZoom/AxisProxy.test.ts Tested: git diff --check -- test/ut/spec/component/dataZoom/AxisProxy.test.ts
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Fixes #21111.
Toolbox
dataZoominjects internaldataZoom.selectcomponents for the target axes. When a value axis usesscale: true, the generated dataZoom window is based on the axis extent, which already uses the stacked result dimension for stacked series. The filtering path still used the raw axis dimension, so stacked area data could be filtered away before rendering.This changes
AxisProxyfiltering to reuse the same axis-dimension selection helper used by extent calculation, keeping stacked data filtered by its rendered stack result dimension.Changes
getDataDimensionsOnAxisin dataZoom filtering.Validation
./node_modules/.bin/jest --config test/ut/jest.config.cjs --coverage=false test/ut/spec/component/dataZoom --runInBandnpm run checktype./node_modules/.bin/eslint src/component/dataZoom/AxisProxy.ts test/ut/spec/component/dataZoom/AxisProxy.test.tsgit diff --check -- src/component/dataZoom/AxisProxy.ts test/toolbox-dataZoom-stack-area.html test/ut/spec/component/dataZoom/AxisProxy.test.tstest/toolbox-dataZoom-stack-area.htmlnpm run checkheaderstill fails on pre-existing unrelated files missing headers; the new files are not listed in that failure.