tayyeowleng opened a new issue, #19248:
URL: https://github.com/apache/echarts/issues/19248

   ### 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);
   
       //Any existing chart has to be destroyed before a new one can be 
initialized
       if (myChart != null && myChart != '' && myChart != undefined) {
         myChart.dispose();
         myChart = null;
       }
   
       // Initialize a new chart
       myChart = echarts.init(this._parentElement, {
         width: 1000,
         height: 400,
       });
   
       let option = {
         title: {
           text: 'Monthly Sales',
           fontFamily: 'Nunito Sans',
         },
         tooltip: {},
         legend: {},
         dataset: {
           dimensions: ['Date', 'Sales'],
           source: data,
         },
         xAxis: { type: 'category' },
         yAxis: {},
         series: [
           {
             type: 'bar',
           },
         ],
       };
       // All the above is applied to the chart
       myChart.setOption(option);
     }
   }
   
   ### Current Behavior
   
   When I perform a mychart.dispose(), I encounter the below error. However 
when I remove the option = {tooltip: {}), it works with 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 (<anonymous>)
       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
   
   ```markdown
   - OS: Windows
   - Browser: Chrome
   - Framework: Javascript
   ```
   
   
   ### Any additional comments?
   
   _No response_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@echarts.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@echarts.apache.org
For additional commands, e-mail: commits-h...@echarts.apache.org

Reply via email to