-
Notifications
You must be signed in to change notification settings - Fork 19.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
eChart tooltip error (TypeError) when mychart.dispose command is included #19248
Comments
This comment has been minimized.
This comment has been minimized.
Thanks for your feedback. Could you please provide an online demo with Codepen or any other editor? |
@tayyeowleng Please provide a demo for the issue either with Official Editor, CodePen, CodeSandbox or JSFiddle. |
Hi I tried but when i initialize a chart in codepen or jsfiddle, it does not need me to do a chart.dispose(), before I initialize again. Thus I am not able to show the error |
Dispose and Rebuild of the Container Node Essentially, this is because the container node of the charts was removed. Even if the node is added again later, the node where the graph is located no longer exists. The correct way is, call echartsInstance.dispose to dispose the instance after the container was disposed, and call echarts.init to initialize after the container was added again. Tips: Call echartsInstance.dispose to release resources while disposing the node to avoid memory leaks. |
One way is to call |
…x potential NPE when its parent node doesn't exists. (#19248)
Sorry I am not clear what changes I need to do to resolve the issue. Please help to enlighten..... |
Am I understanding correctly that this is identified as an issue under tooltip and will be fixed? Thank you! |
Yes. I added a non-null check in #19265 to avoid the error. |
Is the fix already committed? which version of echart will it be? Thank you all! |
It will be in the next version v5.5.0. |
Hi may I check if this is solved in v5.5.0? Thanks! |
Version
5.4.3
Link to Minimal Reproduction
NA
Steps to Reproduce
_parentElement = document.querySelector('.main__table');
createChart(data) {
// Create the echarts instance
let myChart = echarts.getInstanceByDom(this._parentElement); //get any chart instance if it exist
console.log(myChart);
}
}
Current Behavior
When I perform a mychart.dispose(), I encounter the below error. However when I remove the option = {tooltip: {}), it works without error.
TypeError: Cannot read properties of null (reading 'removeChild')
at TooltipHTMLContent.dispose (TooltipHTMLContent.js:452:35)
at TooltipView.dispose (TooltipView.js:819:18)
at echarts.js:1082:7
at Array.forEach ()
at each (util.js:205:13)
at ECharts.dispose (echarts.js:1081:7)
at ChartView.createChart (chartView.js:25:15)
at controlCharts (mainController.js:258:15)
Expected Behavior
mychart.dispose() should not result in any tooltip error
Environment
Any additional comments?
No response
The text was updated successfully, but these errors were encountered: