dsargent opened a new issue, #18459:
URL: https://github.com/apache/echarts/issues/18459
### Version
5.4.1
### Link to Minimal Reproduction
_No response_
### Steps to Reproduce
I don't have a minimal reproducible sample as this is proprietary corporate
code, but my use case is pretty simple:
1) Create a 3D surface plot
2) Add a toolbox or legend of any kind
3) Add an onClick event like this: `onEvents={{click: onChartClick}}` as a
property of the EChart. My particular onClick event updates some fields on the
page that generate a re-render
4) When you click on the chart, boom -- exception down in zrender. The null
pointer is happening on the `this.__layers` part of this code from
canvas/Painter.js in zrender:
```javascript
CanvasPainter.prototype.eachOtherLayer = function (cb, context) {
var zlevelList = this._zlevelList;
for (var i = 0; i < zlevelList.length; i++) {
var z = zlevelList[i];
var layer = this._layers[z];
if (!layer.__builtin__) {
cb.call(context, layer, z);
}
}
};
```
If I remove the legend and toolbox, everything is fine. Adding either of
those causes the exception to happen when clicking on the chart.
I've tried googling, searching your issues and doc, searching zrender's
issues and doc, and even asking chatGPT. The latter suggested adding a `z`
property to the series, which I tried but it didn't help.
Thanks for any suggestions.
### Current Behavior
Crashes with an exception when handling `onClick`
### Expected Behavior
Correctly handles `onClick` without crashing
### Environment
```markdown
- OS: Tested on Ubuntu and MacOS
- Browser: Same on Chrome & Firefox
- Framework: ReactJS/Typescript, using echarts-for-react to wrap ECharts.
```
### 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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]