Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Refreshing LineChart in JavaFX 2.1 - advice for a newbie

956261Aug 16 2012 — edited Aug 16 2012
Hi folks -

I am building a JavaFx GUI that needs to have a chart on one tab of our GUI, that the user can update and then have another variable charted. I can create a series, and I can add it to the chart. I have then tried to clear or remove the series from the chart, in order to draw the same series after modifying that series.. however, I cannot figure out how to redraw that modified series on the chart or destroy (remove?) the exisitng series and create and draw a new series.

In the Oracle documentation, I have only seen this line of code used to cause a series to be drawn on the existing chart:
lineChart.getData().add(series);
but, even if I call
lineChart.getData().remove(series)
and try to add the series again to the chart, with lineChart.getData().add(series), I receive an exception that I am trying to recreate an already created series ('duplicate children added'). What I am trying to do is, display a modified series, as I have changed the data in the series and wish to display that changed series. But I do not see or comprehend what method for getData() does that. How do I get a revised series to display on my lineChart?

I am extremely new to Java and to JavaFX.

Edited by: 953258 on Aug 16, 2012 2:44 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 13 2012
Added on Aug 16 2012
1 comment
3,032 views