Only 44 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JFreeChart Not Plotting Lines  RSS feed

 
Dennis Putnam
Ranch Hand
Posts: 377
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since there seems to be no debugging tools for JFreeChart (1.0.19), I've managed to produce an SSCCE that exhibits the problem. Everything looks right to me but no lines are being drawn and the legend is missing, which I suspect is related. I'm hoping some new eyes can spot what I am missing. Here is the Chart class:

Here is main:

As an aside, note the time of 19:00 in the lower left. I have no idea where that comes from either. Again that might be a clue. TIA.
 
Dennis Putnam
Ranch Hand
Posts: 377
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Apologies. I did not comment out some irrelevant external references in the chart class. This should work better.
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dennis Putnam wrote:As an aside, note the time of 19:00 in the lower left. I have no idea where that comes from either.

You're in UTC-5 time zone, are you?
 
Dennis Putnam
Ranch Hand
Posts: 377
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Correct. I am guessing that you see a different time there because you are in a different time zone. Do you know where that comes from and if is it another symptom of my problem?
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks to me like a time defaulting to 00:00 UTC.

As earlier said, I don't use JFreeChart but I ran your code with some modifications (Threda#sleep raises a red flag in a GUI program, changd that part to use a Swing Timer, and also created the JFrame etc. on the EDT).

You see, that's not really an SSCCE.  For one, you have a method addMarker(String id_,String name_) that's not used.  To create a SSCCE, it's always better to start afresh and add only as much code as is necessary to show the problem.  That makes it (much) easier for someone to be able to help you.

It could be that data points are being added to the LinkedHashMap after the series has been created with zero entries, but I haven't looked to see what the JFreeChart javadocs say about that.
 
Dennis Putnam
Ranch Hand
Posts: 377
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. The addMarker method is irrlevent and can be removed since it is not used in this context. I didn't have a problem with the sleep and I didn't know any other way of spacing the datapoints out so they are at least 1 minute apart (produces a duplicate entry error). From what I read adding datapoints automatically triggers a repaint and is valid. Indeed, I have seen examples of real time plots.
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lines 139 & 144 in the lates posted code: you need getPitDataset() & getProbeDataset() instead of pitTemps & probeTemps.
 
Dennis Putnam
Ranch Hand
Posts: 377
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How dumb is that? I knew new eyes would help, I never would have spotted that myself. Thanks, I owe you one.
 
Dennis Putnam
Ranch Hand
Posts: 377
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oops. I spoke too soon. That is not right. Each call to those methods, creates a new timeseries. I need to just update the existing ones.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!