-
Bug
-
Resolution: Fixed
-
Major
-
2.1.1
-
Security Level: Jimmy
-
None
Steps to Reproduce
Run attached example (chartremoveitem.zul and ChartRemoveItemVM.java)
Click on the get chart data button
chart data is "{"chart":
,"series":[
{"data":[[1,10],[2,15],[3,20],[4,15],[5,5],[6,1],[7,9]],"name":"Test"}]}"
Click the remove button
Click the get chart data button
Chart data is "{"chart":
,"series":[]}"
Click remove again, fails with NPE because chart data is empty
Current Result
1st click delete the expected value but also delete the whole serie on chart data side
2nd click fails due to serie model not existing on server side
Expected Result
removing 1 point shouldn't delete the whole serie
Debug Info
Root Cause
Chart point deletion event is modified by org.zkoss.chart.Series.onChange(OptionDataEvent):931
event.setCurrentTarget(this);
Which cause the event target to become the series rather than the point itself.
Then in org.zkoss.chart.PlotData.onChange(OptionDataEvent):196
list.remove(target);
The target of the event is removed from the model
This cause the series to be removed from data instead of the point
Workaround
Download attached PlotData.java, and add it to classPath while maintaining package structure
- relates to
-
ZKCHARTS-56 model removeValue and addValue cause desynchronization with client
-
- Resolved
-