iReport / jFreeChart - Combining getItemPaint() override and series colors
Posted
by
barneskd
on Stack Overflow
See other posts from Stack Overflow
or by barneskd
Published on 2012-12-17T15:38:19Z
Indexed on
2012/12/17
17:03 UTC
Read the original article
Hit count: 393
I'm attempting to create a bar chart that needs to use specific series colors for N number of categories and a separate color for 1 other category. Here is an example:
http://i.imgur.com/1DeCF.png (Sorry, I don't have enough points to embed images yet)
In the mockup, Categories 1-3 use a collection of 5 colors to render their series while Category 4 uses a single grey color. My first approach was to override the getItemPaint() method using a customizer class, but I can only figure out how to define a color on the category level, not the series level. Is it possible to define colors on category and/or series levels? Something like,
If category != "Category4"
Use colors A, B, C, D, and E in category's series
Else
Use color F in category's series
Another thought I had was to combine iReport's Series Colors bar chart property and the getItemPaint() override; that way I could define the 5 colors to use in iReport and use the getItemPaint() override only in the case where the category equals "Category 4". So far I've had no luck combining the two; if the override is defined it overrides iReport's Series Color property.
© Stack Overflow or respective owner