Hello,
I have following problem:
the customer wants the legend for the stacked bar chart to be inverted as he supposes that in such way it is easier to read the graph.
That means, that not the whole graph must be inverted, but only the order of series in a legend (the colors must still correspond with the graph!).
Is it possible???? And how???
Thank you very much in advance!
Can I invert legend (without inverting the whole chart)?
Can I invert legend (without inverting the whole chart)?
using JFreeChart 1.0.0 rc1, Java 1.4.2
Well, I found it out myself, maybe it can help somebody:
best wishes, Elena
Code: Select all
LegendItemCollection lic = plot.getLegendItems();
LegendItemCollection licInverted = new LegendItemCollection();
int NumberOfLegendItems = lic.getItemCount();
for (int ItemCount = NumberOfLegendItems-1; ItemCount>=0; ItemCount--)
{
licInverted.add(lic.get(ItemCount));
}
plot.setFixedLegendItems(licInverted);
using JFreeChart 1.0.0 rc1, Java 1.4.2