update timeseries chart every 15 seconds
Posted: Sat Jul 07, 2012 9:49 pm
Hi, i developed a timeseries chart using DynamicTimeSeriesCollection my code is
this is the code to invoke chart panl
My problem is in this graph it is adding only one value in the graph. due to that the graph time base is delaying values. Please help me on this.
Thanks in advance....
Code: Select all
final DynamicTimeSeriesCollection dataset = new DynamicTimeSeriesCollection(15, COUNT, new Second());
dataset.setTimeBase(new Second(seconds, minutes, hours, date, month, year));
dataset.addSeries(gaussianData(), 0, "Currency Rate");
chart= createChart(dataset);
timer = new Timer(15000, new ActionListener() {
float[] newData = new float[15];
@Override
public void actionPerformed(ActionEvent e) {
for(i=0;i<15;i++)
newData[i] = randomValue();
dataset.advanceTime();
dataset.appendData(newData);
}
});
Code: Select all
EventQueue.invokeLater(new Runnable() {
public void run() {
PrepareChart chart = new PrepareChart();
System.out.println("In caht getter methoed");
chart.start();[i]// call start method of this class which start timer[/i]
}
});
Thanks in advance....