Reputation: 348
In jfreechart, I have a renderer such as
GroupedStackedBarRenderer renderer = new GroupedStackedBarRenderer();
I my example I have 4 groups of 5 stacked bars (2 bars each stack), all in all 40 bars.
I have used a construction like
renderer.setSeriesPaint(0 + 2 * (length * s + g), <color for this bar>);
renderer.setSeriesPaint(1 + 2 * (length * s + g), <color for this bar>);
in order to color each bar individually, where g denotes the group, 'length' is the number of groups, s the stacked bar number within the group.
Unfortunately this does not work. What am I doing wrong?
Upvotes: 0
Views: 1458
Reputation: 205885
You should be able to create any color scheme you want by overriding getItemPaint()
, as shown in this example. Note the use of StandardXYBarPainter
. It may help to print out a few values, as shown here. If not, please edit your question to include an sscce that shows your approach.
Upvotes: 1