XY Plot with a file as source

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Mauro

XY Plot with a file as source

Post by Mauro » Wed Jun 26, 2002 4:49 pm

Hi,

I have a know formatted file with xy points to plot a graph, the file is like this:

scalex|scaley
x1|y1
x2|y2
x3|y3
. .
. .
x300|y300

This file change continuosly, everytime is being generated other 300 points, it takes about 2 seconds, the file becomes empty and then the newest points are inserted, so I have to be reading it in cycles, continuosly and plotting the graph with these points. This file is created by a real-time application, so the graph has to be a real-time plot.

How can I do it with JFreeChart ?

I'm sorry if it's stupid but I'm new using it.

Cheers,
Mauro

David Gilbert

Re: XY Plot with a file as source

Post by David Gilbert » Wed Jun 26, 2002 5:40 pm

Are you plotting a new set of 300 points every two seconds? As in completely replacing the old points. You can probably handle that with JFreeChart.

If you are adding 300 extra points every two seconds, I suspect you will run into performance problems before too long.

You need to write some code to read your text file and populate an XYSeries instance. Then you can do this:

XYSeriesCollection myDataset = new XYSeriesCollection(series);
myChart.getXYPlot().setDataset(myDataset);

...to update your chart every two seconds.

Regards,

DG.

Mauro

Re: XY Plot with a file as source

Post by Mauro » Wed Jun 26, 2002 6:06 pm

Hi David,

As you said first I'm plotting a new set of 300 points every two seconds replacing the oldest points, always 300 points will be in the file.

Cheers,
Mauro

Locked