Newbies: Dynamic chart for simulation

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

Newbies: Dynamic chart for simulation

Post by David L. » Thu Oct 24, 2002 11:14 am

I am a student who will write a java-based simulation, including the following features:
1. Connection db (e.g. MSAccess) using jdbcodbc
2. retrieve data for calculation
3. storing the update data back to db (jdbcodbc again!)
4. plotting and updating a chart dynamically and simultaneously.

I am rather new in UI. I wanna ask if I could use jFreeChart to achieve the features:
1. Do I have to use Thread?
2. Is the Dynamic chart in jFreeChart suitable for me?

You are more than welcome to give any advice for my implementation.
Thx!!!!!

Dave Gilbert

Re: Newbies: Dynamic chart for simulation

Post by Dave Gilbert » Fri Oct 25, 2002 9:25 am

JFreeChart is 'dynamic' in the sense that changes to your dataset will automatically generate notification messages that are received by the chart. If you display your chart in a ChartPanel, these notifications result in the chart being automatically repainted.

The only thing to consider is that the charts are *completely* repainted, so performance can be an issue (you won't be able to animate charts at 25 frames per second). I have code that refreshes a chart several times per second and it works well for me (on a 600mhz PC), but your mileage may vary. Give it a try...

Regards,

DG

chucky

Re: Newbies: Dynamic chart for simulation

Post by chucky » Sun Oct 27, 2002 9:38 pm

This is very similar to something I am struggling with also. I looked through the old forums and checked through the source code to try and figure out how to do this, but am still not able to get this working. Currently I am removing an old and adding back a new panel (JPanel which contains a chart panel) when a JSlider is updated. Ultimately I would like to automatically run through the values on slider, but I dont think it will work using this approach. I would much rather have the chart repaint itself as you describe.

Another issue is that I would like to keep the chart from rescaling each time the dataset is updated. I am using a line chart to show yield curves on each date.

In summary, I would really like to see the code also and get any other advice for this.

Many thanks,

Chucky

Locked