Skip to content

fix(types): add axis properties to CallbackDataParams. close #17561 - #21836

Open
Prakhar1Ojha wants to merge 1 commit into
apache:masterfrom
Prakhar1Ojha:fix-17561-callback-data-params
Open

Prakhar1Ojha wants to merge 1 commit into
apache:masterfrom
Prakhar1Ojha:fix-17561-callback-data-params

Conversation

@Prakhar1Ojha

Copy link
Copy Markdown

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

Add axis context properties (axisDim, axisIndex, axisType, axisId, axisValue, axisValueLabel) to the public CallbackDataParams type definition.

Fixed issues

Details

Before: What was the problem?

At runtime, whenever tooltips or formatters are invoked in an axis context (e.g., trigger: 'axis'), ECharts populates axis context properties onto callback parameters (axisDim, axisIndex, axisType, axisId, axisValue, and axisValueLabel in src/component/tooltip/TooltipView.ts:587-595).

However, the public TypeScript interface CallbackDataParams in src/util/types.ts omitted these optional properties. As a consequence, TypeScript users writing custom formatter functions (such as formatter: (params: CallbackDataParams) => ...) experienced compile-time errors: Property 'axisValueLabel' does not exist on type 'CallbackDataParams'.

After: How does it behave after the fixing?

  1. Declares optional axisDim, axisIndex, axisType, axisId, axisValue, and axisValueLabel properties on CallbackDataParams in src/util/types.ts.
  2. Simplifies TooltipCallbackDataParams in src/component/tooltip/TooltipView.ts to directly alias CallbackDataParams.
  3. Adds unit tests in test/ut/spec/util/types.test.ts verifying that axisValue and axisValueLabel can be accessed on CallbackDataParams without compiler or runtime diagnostics.

Document Info

  • This PR doesn't relate to document changes

Misc

Security Checking

  • This PR uses security-sensitive Web APIs.

ZRender Changes

  • This PR depends on ZRender changes (ecomfe/zrender#xxx).

Related test cases or examples to use the new APIs

  • test/ut/spec/util/types.test.ts

Merging options

  • Please squash the commits into a single one when merging.

Other information

  • npm run checktype: passed (0 errors)
  • npm run checkheader: passed (0 errors)
  • npm run lint: passed (0 errors, 0 warnings)

@echarts-bot

echarts-bot Bot commented Nov 12, 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.

This branch has not been deployed

No deployments
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] CallbackDataParams type doesn't have axisValue, axisValueLabel properties

1 participant