I am trying to create a Linechart in javafx where the scrollbar 'grows' when a set number of data points is added. The data is added dynamically. What I currently get is all the data being plotted in one window. I would like the data to be added so that after a time, the next data is plotted to the right, and the old data does NOT become visible because it has shifted to the left. I do NOT want to delete the old data, as the user can scroll to the left to view the old data should they wish? Any thoughts please?
I have tried a number of options with no effect. For example:
final NumberAxis xAxis = new NumberAxis();
final NumberAxis yAxis = new NumberAxis();
yAxis.setAutoRanging(false);
xAxis.setAutoRanging(true);
xAxis.setLabel("Time/s");
xAxis.setAnimated(false); // axis animations are removed
yAxis.setLabel("Price");
yAxis.setAnimated(false); // axis animations are removed
goldLineChart.setLegendVisible(false);
//defining a series to display data
XYChart.Series<String, Number> series = new XYChart.Series<>();
xAxis.setForceZeroInRange(false);
// series.setName("Data Series");
// add series to chart
goldLineChart.getData().add(series);
None of this helps. Appreciate any help