You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] ECharts Tooltip 不显示问题 - Vue Ref vs 普通变量 #21267
@trry-hub It seems you are not using English, I've helped translate the content automatically. To make your issue understood by more people and get helped, we'd like to suggest using English next time. 🤗
TRANSLATED
TITLE
[Bug] ECharts Tooltip Not Displaying Issue - Vue Ref vs Regular Variable
BODY
Version6.0.0### Link to Minimal Reproductionhttps://github.com/trry-hub/issues/tree/echarts### Steps to Reproduce## Reproduction Steps### Method 1: Using regular variable (tooltip works fine)typescriptlet chartInstance: null | echarts.ECharts = nullconst chartDom = ref()async function renderChart() { if (!chartInstance) { chartInstance = echarts.init(chartDom.value) } chartInstance.setOption(option)}### Method 2: Using Vue ref (tooltip does not work)typescriptconst chartInstanceVueRef = ref()const chartDomUseRef = ref()async function renderChartUseRef() { if (!chartInstanceVueRef.value) { chartInstanceVueRef.value = echarts.init(chartDomUseRef.value) } chartInstanceVueRef.value.setOption(option)}### Current BehaviorIn Vue 3 ECharts project, when using Vue's ref() to store the ECharts instance, the chart's tooltip does not display correctly. However, when using a regular variable to store the ECharts instance, the tooltip works fine.### Expected BehaviorBoth methods should be able to display the tooltip correctly, showing the corresponding data information when hovering over the chart.### EnvironmentmarkdownSystem: OS: macOS 15.6.1 CPU: (8) arm64 Apple M1 Memory: 94.39 MB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 22.19.0 - ~/.volta/tools/image/node/22.19.0/bin/node npm: 10.9.3 - ~/.volta/tools/image/node/22.19.0/bin/npm pnpm: 10.15.1 - ~/.volta/bin/pnpm Browsers: Chrome: 140.0.7339.133 Safari: 18.6### Any additional comments?## Possible Cause Analysis1. Vue reactive system interference: Vue's ref wraps the object into a reactive proxy, which could affect ECharts' internal event binding mechanism.2. Event listener binding issue: ECharts' tooltip relies on DOM events, and the reactive proxy may interfere with the correct binding of event listeners.3. Instance reference issue: The ECharts instance accessed via ref may differ from the original instance.## Temporary SolutionCurrently, using a regular variable instead of Vue ref to store the ECharts instance can avoid this issue.
The echarts instance is a very large object, so it is not recommended to use ref. Doing so can also lead to significant performance overhead. Instead, you can use shallowRef
Activity
echarts-bot commentedon Sep 16, 2025
@trry-hub It seems you are not using English, I've helped translate the content automatically. To make your issue understood by more people and get helped, we'd like to suggest using English next time. 🤗
TRANSLATED
TITLE
[Bug] ECharts Tooltip Not Displaying Issue - Vue Ref vs Regular Variable
BODY
Version6.0.0### Link to Minimal Reproductionhttps://github.com/trry-hub/issues/tree/echarts### Steps to Reproduce## Reproduction Steps### Method 1: Using regular variable (tooltip works fine)
typescriptlet chartInstance: null | echarts.ECharts = nullconst chartDom = ref()async function renderChart() { if (!chartInstance) { chartInstance = echarts.init(chartDom.value) } chartInstance.setOption(option)}### Method 2: Using Vue ref (tooltip does not work)typescriptconst chartInstanceVueRef = ref()const chartDomUseRef = ref()async function renderChartUseRef() { if (!chartInstanceVueRef.value) { chartInstanceVueRef.value = echarts.init(chartDomUseRef.value) } chartInstanceVueRef.value.setOption(option)}### Current BehaviorIn Vue 3 ECharts project, when using Vue'sref()to store the ECharts instance, the chart's tooltip does not display correctly. However, when using a regular variable to store the ECharts instance, the tooltip works fine.### Expected BehaviorBoth methods should be able to display the tooltip correctly, showing the corresponding data information when hovering over the chart.### EnvironmentmarkdownSystem: OS: macOS 15.6.1 CPU: (8) arm64 Apple M1 Memory: 94.39 MB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 22.19.0 - ~/.volta/tools/image/node/22.19.0/bin/node npm: 10.9.3 - ~/.volta/tools/image/node/22.19.0/bin/npm pnpm: 10.15.1 - ~/.volta/bin/pnpm Browsers: Chrome: 140.0.7339.133 Safari: 18.6### Any additional comments?## Possible Cause Analysis1. Vue reactive system interference: Vue's ref wraps the object into a reactive proxy, which could affect ECharts' internal event binding mechanism.2. Event listener binding issue: ECharts' tooltip relies on DOM events, and the reactive proxy may interfere with the correct binding of event listeners.3. Instance reference issue: The ECharts instance accessed via ref may differ from the original instance.## Temporary SolutionCurrently, using a regular variable instead of Vue ref to store the ECharts instance can avoid this issue.Justin-ZS commentedon Sep 17, 2025
这应该是 Vue 的 bug,为什么报给 echarts ?
trry-hub commentedon Sep 17, 2025
我不确定具体是哪边的问题,所以两边都报了,如果不是 echarts 的问题,就关掉好了。
fullmooooon commentedon Sep 17, 2025
vue-echarts
两个库不兼容也正常,为什么不用现成的 vue-echarts 呢
ngd-b commentedon Sep 21, 2025
The echarts instance is a very large object, so it is not recommended to use
ref. Doing so can also lead to significant performance overhead. Instead, you can useshallowReffix(core): mark echarts instance object as raw in Vue (resolves #21267 …