update timeseries chart every 15 seconds

Discussion about JFreeChart related to stockmarket charts.
Locked
malli108
Posts: 4
Joined: Thu Apr 26, 2012 1:54 pm
antibot: No, of course not.

update timeseries chart every 15 seconds

Post by malli108 » Sat Jul 07, 2012 9:49 pm

Hi, i developed a timeseries chart using DynamicTimeSeriesCollection my code is

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);
            }
        });
this is the code to invoke chart panl

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]
            }
        });
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....

Locked