Legend in two columns

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Sanix
Posts: 9
Joined: Fri Dec 01, 2006 4:25 pm

Legend in two columns

Post by Sanix » Fri Dec 01, 2006 4:27 pm

I have about 4 items on my legend. Its are displayed like this
- bla -bla
- blabal -blabalsd

But it should be displayed like in a table, so it would like this:
- bla____ - blabla
- blablab_- bla

Sanix
Posts: 9
Joined: Fri Dec 01, 2006 4:25 pm

Post by Sanix » Mon Dec 04, 2006 11:43 am

Does nobody know a solution? Do I have to extend the class StandardLegend?

thiagot
Posts: 8
Joined: Wed Aug 23, 2006 7:57 pm

Post by thiagot » Wed Dec 06, 2006 12:38 pm

I have the same problem Sanix
Have u found the solution?
I need 3 columns

I will try to find a solution and then I will reply here

Sanix
Posts: 9
Joined: Fri Dec 01, 2006 4:25 pm

Post by Sanix » Thu Dec 07, 2006 3:04 pm

No, unfortunately not. But would be really nice, if someone could help us or tell us at least which class we need to extend.

svicheck
Posts: 19
Joined: Fri Nov 17, 2006 10:21 pm

Post by svicheck » Thu Dec 07, 2006 3:58 pm

I also have the same problem, although the number of columns and rows tend to be more dynamic in nature. I attempted to provide my own instance of LegendTitle using a GridArrangement for arrangement, but I think after setting it all up I simply received an UnsupportedOperationException or something similar.

It is quite possible that I was doing something wrong, but I have considered it a dead-end at the moment. I would be extremely interested if anyone has a workable solution.

kgentile1010
Posts: 1
Joined: Wed Dec 20, 2006 5:17 pm

I also have this problem -- maybe for xmas....

Post by kgentile1010 » Wed Dec 20, 2006 6:16 pm

I also saw the info about getting the legend instance and reformatting it. Where does this code go? I can try to work it out and then post a solution if I'm successful. I'm using jasperreports and iReports to create the chart.

eric74b
Posts: 5
Joined: Mon Apr 07, 2008 6:09 pm
Location: US

Post by eric74b » Sat Apr 12, 2008 5:57 am

Did anyone find any solution to this yet?

1337rooster
Posts: 6
Joined: Mon Apr 14, 2008 3:06 pm

Hackish fix idea

Post by 1337rooster » Mon Apr 14, 2008 3:08 pm

I ran into something similar to this, I think my same hackish approach will work. I'm not sure if JFreeChart built in method to make the columns, if it does I would recommend using that.

Basically, what you can do is make every key the same length in characters. So write some code to add trailing white spaces to the end of the keys so they all have the same length (equal to the length of the longest key), before adding them to your dataset.

Locked