Real Time Charts

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
news918
Posts: 4
Joined: Tue Apr 12, 2005 3:05 pm

Real Time Charts

Post by news918 » Fri Jul 27, 2007 3:55 pm

Hi,

I like to know what is the best aproach to show information in real time. By real time I mean 10 or 15 seconds.

The main idea is to get data from a database and constantly show it in a TimeSeries chart.

TIA.
Julio

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Tue Jul 31, 2007 4:46 pm

If you display the chart in a ChartPanel, it will automatically update when the dataset is changed. So you need to write some code that uses a timer to fetch the latest values from the database periodically and insert them into the dataset...just be aware that JFreeChart is not thread-safe, so you should update the dataset from the event dispatch thread to ensure that the dataset doesn't change halfway through repainting the chart (which can cause some odd exceptions sometimes).
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

Locked