Elo guys, i have been trying to create a real-time graph for my application!! I'm using JFree_Graph!

I have modifed a code so as to include a thread but eventually got errors.

[copyrighted code removed]

And the output is


Entering Thread
Now = Wed Mar 12 14:58:16 EET 2008
Entering Thread
Now = Wed Mar 12 14:58:17 EET 2008
Entering Thread
Now = Wed Mar 12 14:58:17 EET 2008
Exception in thread "Thread-2" org.jfree.data.general.SeriesException: You are attempting to add an observation for the time period Wed Mar 12 14:58:17 EET 2008 but the series already contains an observation for that time period. Duplicates are not permitted. Try using the addOrUpdate() method.
at org.jfree.data.time.TimeSeries.add(TimeSeries.java:497)
at org.jfree.data.time.TimeSeries.add(TimeSeries.java:526)
at newGraph.captureData(newGraph.java:162)
at newGraph$1.run(newGraph.java:187)
at java.lang.Thread.run(Unknown Source)

Some points have been plotted but then the error occurs!!
Can anyone please take a look at the code please!
thanks!

I haven't used JFree_Graph before, but that stack trace has given you a pretty detailed description of the encountered problem. I'm guessing that your problem line of code is:

series.add(new Millisecond(), lastValue);

Try changing it to:

series.addOrUpdate(new Millisecond(), lastValue);

and see what happens.

Hey thanks, it worked!!
I thought it was add or updated and not addOrUpdate!! hmmm foolish from my part haha!!!

Rethanks mate!!

The source you posted is copyrighted and not for distribution.
If you got it from any other source than the author by buying the user guide you are using pirated software which is a criminal act.

jwenting is correct. That code is only available with a purchased a copy of the Developers Guide and I am sure the author does not want it posted for free.

Flagging it a bad post so a mod can delete that code.

jwenting is correct. That code is only available with a purchased a copy of the Developers Guide and I am sure the author does not want it posted for free.

Flagging it a bad post so a mod can delete that code.

Oops!!!!!
Something i don't understand very well!! i thougth JFree_graph is a free library Or is it that the code using the library is copyright?????

The library is free and does have one or two demo sources in it. The developer sells a downloadable developer's guide which includes all of those demos to help support development of the open source library. It is those demos that you cannot post here.

Thanks about the info!!!

Is there a way to edit my posts!!! i don't see any EDIT button!!!!!

I flagged it as a "Bad Post" with a note about the copyrighted code so a moderator can edit that out. Users can only edit their post for 30 minutes after it's been posted.

I flagged it as a "Bad Post" with a note about the copyrighted code so a moderator can edit that out. Users can only edit their post for 30 minutes after it's been posted.

i have to learn a little bite more about thoses copyright issues!!
Anyway this forum has been of huge help!!!
Much Thanks!!!
Cya

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.