-
Bug
-
Resolution: Cannot Reproduce
-
Critical
-
7.2.2.0
-
Security Level: Jimmy
-
None
Steps to Reproduce
1. run
<button onClick="setEmptyData()"/> <charts id="chart"/> <zscript><![CDATA[ import org.zkoss.chart.*; public void setEmptyData(){ chart.getSeries().setData(new Point[0]); } ]]></zscript>
2. click the button
Current Result
- click 1st time
TypeError: this.addSeries is not a function
- click the 2nd time
TypeError: Cannot read properties of undefined (reading '0')
Expected Result
no error
Debug Information
- key statement chart.getSeries().setData(new Point[0]);
- the original use case:
The dev doesn't plan to pass an empty array on purpose. He creates an array from a query resultPoint[] pointArray = new Point[queryResult]; chart.getSeries().setData(pointArray);
Propose solution
The method should check the size and render nothing for an empty array. So this will benefit callers.