How to display data dynamically in jfreechart

I created a function that processes some value. Now my problem is that the created graph displays the values ​​generated after ALL the values ​​have been calculated. I want to generate a graph so that the data is calculated when and when the data is calculated; It must be applied to the data. Calculation and display of data on the graph should be displayed in parallel. I generated a graph like:

 dataset.addSeries(series1); 
 dataset = new XYSeriesCollection();

 series1 = new XYSeries("% ERROR");
 chart = ChartFactory.createXYLineChart("Percent Error", "Number of Records", "% Error", dataset,PlotOrientation.VERTICAL,true, true, true);
 chart.setBackgroundPaint(Color.WHITE);
 frame = new ChartFrame("Error graph", chart);
 frame.pack();
 frame.setVisible(true);

Row 1 is shown in the graph. The values ​​in sequence 1 are added at each iteration of the loop that generates some value. Can this be done using wait and notify? I am not sure about that. Please, help

+3
source share
2 answers

add() XYSeries " SeriesChangeEvent ". , add() javax.swing.Timer, .

+1

, DinamycTimeSeriesCollection? .

question .

0

Source: https://habr.com/ru/post/1794917/


All Articles