• Post Reply Bookmark Topic Watch Topic
  • New Topic

JFreeChart Getting the TimeSeries Line Color  RSS feed

 
Dennis Putnam
Ranch Hand
Posts: 377
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a working JFreeChart with several TimeSeries. Each series is being assigned a line color in association with an 'XYLineAndShapeRenderer'. I need to extract the assigned color to each specific line. It is not at all clear from the documentation where/when to extract that color. When I create the 'TimeSeries' there is no method for getting the assigned color for that instance. If not there then where else would it be assigned and what method retrieves it? TIA.
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
getSeriesPaint(0) seems to do it.
 
Dennis Putnam
Ranch Hand
Posts: 377
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. That is the crux of my question. That method is tied to the XYLineAndShapeRenderer not a specific series. Maybe a better question is how do I know what the index is for a particular series so I can use it for that method?
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Adding a few sysouts suggested that the series are indexed in the order added, starting from 0.  Couldn't find that documented though.
 
Dennis Putnam
Ranch Hand
Posts: 377
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. That seems to solve my problem as long as I can always count on the order being consistent. That makes be a bit nervous as there ought to be a getter tied to each series.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!