There are several cases when XYChart's data (or series) manipulation fails:
* when data is moved from one chart to another or between series (RT-37798)
* when data is added as a duplicate (RT-37824)
* when data from a different series is added, but it's not removed from the previous series
These scenarios often produce artifacts (esp. when charts are animated) or exceptions. The problem is that since Data removal may be animated, the data can be part of a chart even after it has been removed from the data list. It it necessary to wait until the data is freed, before it is added to another chart.
I propose the following solution to solve the problem:
* Add seriesProperty and chartProperty that show the real association with a chart/series and are set to null when the data is really released. That should be immediate when chart is not animated.
* Make Data extend Clonable for cases where it's not possible to wait for data release.
* Throw exceptions when manipulating with data that is still associated with a chart. That would solveRT-37824.
* Allow subclasses to react on the case when data is moved inside the series. Currently, there's only package-private method for that.
* when data is moved from one chart to another or between series (
* when data is added as a duplicate (
* when data from a different series is added, but it's not removed from the previous series
These scenarios often produce artifacts (esp. when charts are animated) or exceptions. The problem is that since Data removal may be animated, the data can be part of a chart even after it has been removed from the data list. It it necessary to wait until the data is freed, before it is added to another chart.
I propose the following solution to solve the problem:
* Add seriesProperty and chartProperty that show the real association with a chart/series and are set to null when the data is really released. That should be immediate when chart is not animated.
* Make Data extend Clonable for cases where it's not possible to wait for data release.
* Throw exceptions when manipulating with data that is still associated with a chart. That would solve
* Allow subclasses to react on the case when data is moved inside the series. Currently, there's only package-private method for that.
- relates to
-
JDK-8095769 [Charts] Series: NPE when adding data items after deletion of data
- Resolved
-
JDK-8097310 [Charts] Series: NPE when adding data items multiple times
- Resolved