Skip to content

Conversation

@plainheart
Copy link
Member

@plainheart plainheart commented Sep 26, 2025

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

For a long time, many Vue developers have used ref or reactive by default to wrap the echarts instance object, which makes ECharts' internal properties also converted into a Proxy. As a result, all judgment logic in the ECharts internal code that uses === to determine whether two objects are identical returns false, which causes some components, such as the tooltip under the axis, not to function properly. Example:

image

In the above code snippet, axis is the original object, but coordSys.getAxis(axis.dim) returns a proxied object. The two are no longer identical, resulting in missing data collected by collectSeriesInfo and a non-functional axis tooltip. Similar code libraries may also contain similar situations.

Although I previously added relevant instructions at FAQ and included usage warnings from the official Vue documentation, and reiterated this in the GitHub issue: #17723 (comment), many developers still remain unaware and continue to file issues. Until I saw another issue today, I thought it is time to address this issue.

I've considered two solutions to this problem:

  • Prominently remind Vue users in the documentation or Handbook to use shallowRef, shallowReactive, or common variables to receive echarts instances, or to mark instances as non-proxied using markRaw. - But this does not solve the root issue.

  • Add a line of Vue-specific code to the echarts constructor to mark echarts objects as non-proxied by default. - This is what this PR does.

Fixed issues

Details

Before: What was the problem?

When wrapping the echarts instance object with ref/reactive in Vue, some components, like tooltip, can't work as expected.

After: How does it behave after the fixing?

Mark the echarts instance as raw to prevent the object from being converted to a proxy.

image

Document Info

One of the following should be checked.

  • This PR doesn't relate to document changes
  • The document should be updated later
  • The document changes have been made in apache/echarts-doc#xxx

Misc

ZRender Changes

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

Related test cases or examples to use the new APIs

See test/echarts-in-vue.html

Others

Merging options

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

Other information

@echarts-bot
Copy link

echarts-bot bot commented Sep 26, 2025

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.

The pull request is marked to be PR: author is committer because you are a committer of this project.

@github-actions
Copy link
Contributor

@100pah 100pah merged commit 37209e2 into master Sep 26, 2025
2 checks passed
@echarts-bot
Copy link

echarts-bot bot commented Sep 26, 2025

Congratulations! Your PR has been merged. Thanks for your contribution! 👍

@plainheart plainheart deleted the fix/markRaw-in-vue branch September 26, 2025 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment