getting exception when adding data to Timeseries Chart

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
mguerra
Posts: 4
Joined: Wed Oct 08, 2003 9:05 pm

getting exception when adding data to Timeseries Chart

Post by mguerra » Mon Jan 12, 2004 5:19 pm

I tryed to change the MemoryUsage Chart to take in data that I generate but when I call free.add(new Millisecond(), y); with data I am generating I get an exception saying that I can not add duplicate data and that I already added data at a specified time. Do you know what is going on and how can I fix this. Or can someone send some source. Basically I am just trying to get a basic realtime chart going so am using this example but modified it slilghtly to take in my data.

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 Jan 13, 2004 9:42 pm

Probably there isn't sufficient delay between the creation of the Millisecond objects, so you end up with two Milliseconds for the same period in time. The TimeSeries class won't let you add a new observation for a period that already exists in the series.

In the MemoryUsage demo, there is a timer that ensures that an observation is added to the series only once per 100 milliseconds, so this problem is avoided.
David Gilbert
JFreeChart Project Leader

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

Locked