Hi all.
Just started looking at JFreeChart. On my opinion.
Last version(s) of the product gives good ability to "wrap" entities if entity name is too long. For example if my Category name consist of 30 letters JFreeChart correctly cuts is to less amount of letters and displays them followed by points. It is really good feature indeed.
I wonder is there a way to replace this long names with some IDs (numbers for example) and (!) provide "legend" that will describe which number corresponds to which (full) category name?
Thanks in advance.
How to make a "legend" for long category names?
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
I don't fully understand what you are looking for, but I have been doing some work on a more flexible legend for a client, so if you can describe your requirement in detail I might be able to work it into the new code.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


Thanks for response, David.
I agree that it is not easy to understand what I want. I'll try to explain as usecase.
I have a chart with 20 categories. Each Category has a name of 20 chars.. Of course when I list these names horizontaly - the library cuts category names to 3 chars and + "..." . This is correct behavior nad I agree with it. But I'd like users to see actual category names on chart since generally first three letters could be the same for two different Categories.
One method is to use "shortcuts" for category names. I.e. label the first category '1' , the second - '2' etc. And put some notation at the chart that "'1' means LONG_NAME_OF_THE_FIRST_CATEGORY", "'2' means LONG_NAME_OF_THE_SECOND_CATEGORY" etc.
Hope it became more clear? If not please tell me - I'll try to give more information.
Thank you,
Kostya
I agree that it is not easy to understand what I want. I'll try to explain as usecase.
I have a chart with 20 categories. Each Category has a name of 20 chars.. Of course when I list these names horizontaly - the library cuts category names to 3 chars and + "..." . This is correct behavior nad I agree with it. But I'd like users to see actual category names on chart since generally first three letters could be the same for two different Categories.
One method is to use "shortcuts" for category names. I.e. label the first category '1' , the second - '2' etc. And put some notation at the chart that "'1' means LONG_NAME_OF_THE_FIRST_CATEGORY", "'2' means LONG_NAME_OF_THE_SECOND_CATEGORY" etc.
Hope it became more clear? If not please tell me - I'll try to give more information.
Thank you,
Kostya
Any luck here?
I want to achieve the same thing here. I get 50 titles (~ 75 characters) and the pie chart is becoming messy.
I would like to abbreviate the names while displaying on chart and put the long names in legend. Ex.
In pie chart:
TITLE 1: 10%
TITLE 2: 10%
TITLE 3: 10%
.
In legend:
TITLE 1: LONG TEXT FOR TITLE 1
TITLE 2: LONG TEXT FOR TITLE 2
I would like to abbreviate the names while displaying on chart and put the long names in legend. Ex.
In pie chart:
TITLE 1: 10%
TITLE 2: 10%
TITLE 3: 10%
.
In legend:
TITLE 1: LONG TEXT FOR TITLE 1
TITLE 2: LONG TEXT FOR TITLE 2
I am trying to solve the exact same problem at the moment. I created a new LegendItemCollection and added it to the plot using setFixedLegendItems. Each LegendItem contains the long name of the truncated Category names.
The problem now is that I want each LegendItem to be on its own line inside the Legend box. Anyone know if this is possible?
The problem now is that I want each LegendItem to be on its own line inside the Legend box. Anyone know if this is possible?