Dynamic Plotting in JAVA

wantedSpidy

Senior member
Nov 16, 2006
557
0
0
Hey guys,

I have another question for all your smart AT'ers.

OK so I have aan application which currently performs some operations on files and plots them and creates some other visualizations.

I need to make my application more dynamic, in the sense, I want to be able to update my input file and then see the change in the graphs I'm outputting. Eventually I will change it to some sort of stream, once my research group finalizes on the nitty-gritty details of the project. But for now, do you guys have suggestions on how to do this?

An example:
Input
time, value
1, 100.2
2, 100.5
3, 100.6

Output: Time on X axis and the value on Y axis.

Then *while* my applications is already running, I want to be able to append
4, 100.8
5, 100.8

and then have my graph plot those additional points as well!!

Is it possible? Any nice packages out there?

Sorry for so many questions!! I'm more of a C programmer, all this Java GUI programming is new to me 😀

Thanks
 

Onund

Senior member
Jul 19, 2007
287
0
0
I don't believe there is a way in java to listen for file changes.

First thing that comes to my mind is to setup a timer and check for modification to the file periodically.

I'm guessing you're creating a File object to read the file. There is lastModified() property you can use to see if the file has changed since the last time it checked.
 

statik213

Golden Member
Oct 31, 2004
1,654
0
0
Originally posted by: Onund
I don't believe there is a way in java to listen for file changes.

First thing that comes to my mind is to setup a timer and check for modification to the file periodically.

I'm guessing you're creating a File object to read the file. There is lastModified() property you can use to see if the file has changed since the last time it checked.

Yeah, your best bet would be to poll the File's lastModified()....