I tried searching for a over a day to find a way to do this ... is there anyway to make the items in a Legend be ordered (like a basic HTML table). The legend looks fine when you have 1-6 items but when you get over that and it goes to the next line, you are basically using an (ugly) FlowLayout .....
What I have currently is this:
and I want something like this (yeah it's hand editted so it's not exactly right):
Any help would be greatly appreciated.
Legend - Tabular Layout
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
There are hooks to enable you to control the layout of the legend items, but as yet no layout manager that can do the table layout for you (it would certainly be a nice addition to JFreeChart). You'll notice that in the LegendTitle constructor, there are two arguments vLayout and hLayout. These are layout managers - one controls the layout of items when the legend is at the left or right of the chart, the other takes control when the legend is at the top or bottom of the chart.
For now, the standard layout is a "flow" layout, and there aren't really any other standard options. I've added a Feature Request for this:
http://sourceforge.net/tracker/index.ph ... tid=365494
For now, the standard layout is a "flow" layout, and there aren't really any other standard options. I've added a Feature Request for this:
http://sourceforge.net/tracker/index.ph ... tid=365494
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
Re: Legend - Tabular Layout
Hi David,
Is this Feature Request still open in the current SVN trunk version (it is in the SF bug tracker at least)? We are a team of students supposed to work on a open source project and have chosen to collaborate on JFreeChart.
If this Feature is not yet implemented, we would like to try to take it up and implement it if it turns out to be of reasonable complexity.
Could you give a hint on where we would hook in for creating such a new LegendRenderer? We sure wouldn't like to break the overall design of JFreeChart by adding it in a unusual way…
What we would think of two ways to offer a tabular layout to the user:
1. offer an integer parameter "columns" and divide available space equally
2. a little more intelligent algorithm trying to find best column widths by looking at the actually widths of the labels contained.
Any comments on that?
Thanks for your time,
Johannes and Ralf
Is this Feature Request still open in the current SVN trunk version (it is in the SF bug tracker at least)? We are a team of students supposed to work on a open source project and have chosen to collaborate on JFreeChart.
If this Feature is not yet implemented, we would like to try to take it up and implement it if it turns out to be of reasonable complexity.
Could you give a hint on where we would hook in for creating such a new LegendRenderer? We sure wouldn't like to break the overall design of JFreeChart by adding it in a unusual way…
What we would think of two ways to offer a tabular layout to the user:
1. offer an integer parameter "columns" and divide available space equally
2. a little more intelligent algorithm trying to find best column widths by looking at the actually widths of the labels contained.
Any comments on that?
Thanks for your time,
Johannes and Ralf
Re: Legend - Tabular Layout
Hi!
Thanks for helping out with this. If the request is still open in the tracker, it's very likely that it still hasn't been implemented.
It would be great, if you could offer a patch for this. However, I currently don't know the code and don't have the time to look at it, so I'm afraid, I can't be of big help for you.
You could also try to jfreechart-developers Mailinglist to get some help.
Implementing the feature via 1. or 2. is up to you. If the user could choose, it would be even better
hth,
- martin
BTW, two other students also just offered to fix some bug as part of their studies via the dev-mailinglist.
Thanks for helping out with this. If the request is still open in the tracker, it's very likely that it still hasn't been implemented.
It would be great, if you could offer a patch for this. However, I currently don't know the code and don't have the time to look at it, so I'm afraid, I can't be of big help for you.
You could also try to jfreechart-developers Mailinglist to get some help.
Implementing the feature via 1. or 2. is up to you. If the user could choose, it would be even better
hth,
- martin
BTW, two other students also just offered to fix some bug as part of their studies via the dev-mailinglist.
Re: Legend - Tabular Layout
Thanks for your input, matinh!
We have posted a solution approach on the developers mailing list and hope that this feature will be available soon .
We have posted a solution approach on the developers mailing list and hope that this feature will be available soon .