0

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

  • not supported in charts - you need to add it to a ScrollPane and handle the logic your self – kleopatra Mar 24 '19 at 11:46
  • 1
    This may help https://stackoverflow.com/questions/38030926/scrollpane-line-chart-with-fixed-view-y-axis-javafx – SedJ601 Mar 24 '19 at 14:30

0 Answers0