fix(candlestick/boxplot): resolve base axis correctly when series uses xAxisId/yAxisId - #21727
fix(candlestick/boxplot): resolve base axis correctly when series uses xAxisId/yAxisId#21727waterWang wants to merge 1 commit into
Conversation
…s xAxisId/yAxisId fix apache#21725
|
Thanks for your contribution! Please DO NOT commit the files in dist, i18n, and ssr/client/dist folders in a non-release pull request. These folders are for release use only. 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
Fixes axis resolution for candlestick and boxplot series using axis IDs.
Changes:
- Uses
getReferringComponentsfor ID- and index-based axis lookup. - Adds regression and fallback tests.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/chart/helper/whiskerBoxCommon.ts |
Corrects referenced-axis resolution. |
test/ut/spec/series/whiskerBoxCommon.test.ts |
Adds axis-ID and default-axis tests. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| { id: 'main-x', type: 'value', gridIndex: 0 }, | ||
| { id: 'second-x', type: 'value', gridIndex: 1 } |
fix #21725
Problem
getInitialData()andgetBaseAxis()inWhiskerBoxCommonMixin(used by candlestick and boxplot series) were hardcoded to useecModel.getComponent(mainType, this.get('xAxisIndex')). When a series specifiesxAxisId/yAxisIdinstead ofxAxisIndex/yAxisIndex,this.get('xAxisIndex')returnsundefined, causingecModel.getComponentto fall back to the first axis component. This leads to incorrect axis resolution in multi-grid layouts.Fix
Replace
ecModel.getComponentwiththis.getReferringComponents(mainType, SINGLE_REFERRING)which properly handles bothxAxisIndex/xAxisId(andyAxisIndex/yAxisId). Falls back to the first axis when neither is specified, preserving backward compatibility.Test
New unit test
whiskerBoxCommon.test.ts:xAxisId