Dynamic charting getting stuck

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
palmer
Posts: 2
Joined: Fri Jun 30, 2006 4:22 pm
Location: UK

Dynamic charting getting stuck

Post by palmer » Fri Jun 30, 2006 5:43 pm

Hi everyone

This is my first message in this forum and before my moans I would like to reassure you I'm a JFreeChart fan. It's great!
I assume some of you must have experienced my problem of charts seeming to lock up, or freeze, yet I have been unable to find anything related to it here.

I have created a dynamic chart using XYPlot with TimeSeries using the Millisecond class. I have three series in my chart which are populated by a seperate thread. This thread reads messages from a buffer which arrive every 2 seconds and contain 50 values. i.e. 25 samples per second.

I'm careful to use the .setNotify(false)/.setNotify(true) methods, as others have advised, from my thread when I add new samples to my series' The problem is that sometimes my charts just stop updating. I can see that the application is still running and that data is arriving. However the charting thread stalls at the point of adding data to the series and the chart becomes unresponsive. Has anyone experienced this before?

I've also been wondering about using the Milisecond class for the timeseries. I only need to plot 25 samples per second, not 1000. I would like to set my history to 30 mins but the chart becomes very slow to update as thats 1.8 million samples per series! Would it be possible to make my charting more efficient my producing an intermediate 25-sample-per-second timeseries class?

Thanks for all your support.

alex

pmarsollier
Posts: 49
Joined: Thu Jul 08, 2004 8:54 am
Location: France

Post by pmarsollier » Mon Jul 03, 2006 8:36 am

I've been searching for months for that kind of bug, sometime my graph just did'nt show ...

I found that it was because sometime, the value I had produced PathException, it could not be draw, hanging in a native call.

track down null, 0, infinite ... etc ...
especially with dynamic , oyou often compute base on current time ..., minutes can be null ....

maybe it can help .....

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

Re: Dynamic charting getting stuck

Post by david.gilbert » Mon Jul 03, 2006 10:57 am

I don't have any useful info to offer regarding the bug you are seeing, but if you track anything down, please let me know. For reference, could you also post the version info (JFreeChart, JRE and OS) for your system?
palmer wrote:I've also been wondering about using the Milisecond class for the timeseries. I only need to plot 25 samples per second, not 1000. I would like to set my history to 30 mins but the chart becomes very slow to update as thats 1.8 million samples per series!
There's no need to add data to the series for every millisecond, just the ones you have observations for. You could write your own RegularTimePeriod subclass, but it shouldn't be necessary.
David Gilbert
JFreeChart Project Leader

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

palmer
Posts: 2
Joined: Fri Jun 30, 2006 4:22 pm
Location: UK

Re: Dynamic charting getting stuck

Post by palmer » Mon Jul 03, 2006 4:57 pm

david.gilbert wrote:I don't have any useful info to offer regarding the bug you are seeing, but if you track anything down, please let me know. For reference, could you also post the version info (JFreeChart, JRE and OS) for your system?
palmer wrote:I've also been wondering about using the Milisecond class for the timeseries. I only need to plot 25 samples per second, not 1000. I would like to set my history to 30 mins but the chart becomes very slow to update as thats 1.8 million samples per series!
There's no need to add data to the series for every millisecond, just the ones you have observations for. You could write your own RegularTimePeriod subclass, but it shouldn't be necessary.

I've been using JFreeChart 1.0.1, JCommon 1.0.4, JRE 1.5.0_06 on Windows XP. I've been testing the application on various machines but all with same result.

I realise I created the impression that I was adding data for every millisecond. In fact I am only adding a new value every 40mS (i.e 25 per second). The unspecified data are, I assume, interpolated and stored. Or are they stored and then interpolated? Either way I was thinking that a new class may work a little more efficiently.

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 » Mon Jul 03, 2006 5:00 pm

Thanks. The unspecified data are never stored, the chart just connects the defined points with a line, so the "interpolation" is visual only...nothing is added to the dataset.
David Gilbert
JFreeChart Project Leader

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

skunk
Posts: 1087
Joined: Thu Jun 02, 2005 10:14 pm
Location: Brisbane, Australia

Post by skunk » Mon Jul 03, 2006 5:12 pm

Like every other swing componenet, JFreeChart is NOT thread safe. You need to make sure that any operation that will result in a redraw of the chart (ie adding new data points) only ever happens on the event dispatching thread. You will need to use a mechanism like SwingUtilities.invokeLater()

Locked