Reputation: 3179
I using a JavaFX LineChart to display server performance, i want the graph to be updated dynamically with the data fetch from the servers.
How can i add new data one the graph and keep always the same time range in graph (in my case the time is X axis), and Y axis is number of request per second.
edit: I using latest JavaFX JDK7u6
Upvotes: 1
Views: 8945
Reputation: 49185
Get the series:
XYChart.Series<Number, Number> s = lineChart.getData().get(0);
Shift the time frame/range by removing first element and adding new one:
s.getData().remove(0);
s.getData().add(new LineChart.Data<Number,Number>(time_from_server, data_from_server));
Upvotes: 3