Currently when I use the StackedXYAreaChart, the area first series is displayed at the bottom of the chart, and the legend also shows the chart color of the first series on the left most position.
Eg.
Chart:
C
B
A
Legend: A B C
Is there a way to make it such that the legned will start showing series from the top most area to the bottom one?
Chart:
A
B
C
Legend: A B C
order of series in the legend.
JFreecharts 1.0.0-rc1
It looks like the StandardLegend class has been depricated. Is there anyway to reverse the legend order using the new Block classes?
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
You'll need to override the getLegendItems() method in the XYPlot class to change the order of the items. Better still, modify XYPlot to include a flag that determines the order of the returned items, and submit a patch that I can incorporate into the next release.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
I was thinking of a more generalized change to LegendTitle or BlockContainer. Perhaps if done right it could be implemented in one location, and then applied to each plot type.
However, I am not sure if this would work correctly, because the calculation of the bounding box might be depended on display order. Perhaps serveral methods in BlockContainer and Arrangement would have to change.
As I look at the code it seems like your proposed method would be much simpler, although it would have to be made to each implementation of getLegendItems.
At this stage what do you suggest?
1) modify XYPlot.getLegentItems()
2) modify LegendTitle, BlockContainer, Arrangement
However, I am not sure if this would work correctly, because the calculation of the bounding box might be depended on display order. Perhaps serveral methods in BlockContainer and Arrangement would have to change.
As I look at the code it seems like your proposed method would be much simpler, although it would have to be made to each implementation of getLegendItems.
At this stage what do you suggest?
1) modify XYPlot.getLegentItems()
2) modify LegendTitle, BlockContainer, Arrangement