Skip to content

fix(candlestick/boxplot): resolve base axis correctly when series uses xAxisId/yAxisId - #21727

Open
waterWang wants to merge 1 commit into
apache:masterfrom
waterWang:fix-candlestick-getbaseaxis-xaxisid
Open

fix(candlestick/boxplot): resolve base axis correctly when series uses xAxisId/yAxisId#21727
waterWang wants to merge 1 commit into
apache:masterfrom
waterWang:fix-candlestick-getbaseaxis-xaxisid

Conversation

@waterWang

Copy link
Copy Markdown

fix #21725

Problem

getInitialData() and getBaseAxis() in WhiskerBoxCommonMixin (used by candlestick and boxplot series) were hardcoded to use ecModel.getComponent(mainType, this.get('xAxisIndex')). When a series specifies xAxisId/yAxisId instead of xAxisIndex/yAxisIndex, this.get('xAxisIndex') returns undefined, causing ecModel.getComponent to fall back to the first axis component. This leads to incorrect axis resolution in multi-grid layouts.

Fix

Replace ecModel.getComponent with this.getReferringComponents(mainType, SINGLE_REFERRING) which properly handles both xAxisIndex/xAxisId (and yAxisIndex/yAxisId). Falls back to the first axis when neither is specified, preserving backward compatibility.

Test

New unit test whiskerBoxCommon.test.ts:

  • Verifies that each series in a multi-grid config gets the correct base axis when using xAxisId
  • Verifies backward compatibility (no index/id → first axis)

@echarts-bot

echarts-bot Bot commented Aug 11, 2026

Copy link
Copy Markdown

Thanks for your contribution!
The community will review it ASAP. In the meanwhile, please checkout the coding standard and Wiki about How to make a pull request.

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: PR: doc ready, PR: awaiting doc, PR: doc unchanged

This message is shown because the PR description doesn't contain the document related template.

@plainheart
plainheart requested a balanced review from Copilot August 13, 2026 05:45
@plainheart plainheart added this to the 6.1.1 milestone Aug 13, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes axis resolution for candlestick and boxplot series using axis IDs.

Changes:

  • Uses getReferringComponents for 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.

Comment on lines +37 to +38
{ id: 'main-x', type: 'value', gridIndex: 0 },
{ id: 'second-x', type: 'value', gridIndex: 1 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] X-Axis behaves differently in two grids with same candlestick-data

3 participants