JavaFX Duplicate Series Added

霸气de小男生 提交于 2019-11-28 13:51:26

This issue could also happen if you have :

animated="true"

set for your line chart.

When the class XYChart checks for duplicates, it takes all the series from displayedSeries and compares them with your existing data series. During this time, if you have cleared the data, the series will still be in the displayedSeries due to the prolonged fading effect and result in the "duplicate series added" error.

If that is the case, simply set :

animated="false"

I think it is a JavaFX bug. I had the same problem. I "solved" it removing the chart (linePlot in your case) and creating it again.

This seems to be a bug when changing the chart data with animation. As mentioned by @Anurag if you turn off the animation you will not face the issue.

e.g.

linePlot.setAnimated(false);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!