Legend Superscripts

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
hookumsnivy
Posts: 13
Joined: Mon Aug 14, 2006 9:14 pm

Legend Superscripts

Post by hookumsnivy » Mon Oct 16, 2006 9:21 pm

I have a need to have some text formatted as a superscript in a legend label. Basically I want to do this for footnoting purposes.
Is this currently supported?
If not, how would I go about implementing this?
If it makes it easier, the superscript text could be at the end of the label.

Carl Manaster
Posts: 35
Joined: Tue Mar 28, 2006 1:10 am
Location: La Jolla
Contact:

A couple of helpful links

Post by Carl Manaster » Tue Oct 17, 2006 4:32 pm

here
and here.

Particularly if all you need is numbers, it's not hard at all.

hookumsnivy
Posts: 13
Joined: Mon Aug 14, 2006 9:14 pm

Post by hookumsnivy » Tue Oct 17, 2006 5:14 pm

Thanks.

Doesn't get much easier than that since I'm only using numbers in this case.

hookumsnivy
Posts: 13
Joined: Mon Aug 14, 2006 9:14 pm

Post by hookumsnivy » Tue Oct 17, 2006 7:25 pm

There are 2 problems here:

1. Only certain fonts will work (easy enough to use a different font).
2. The superscript numbers 1-3 look significantly smaller than 4-9,0 in SansSerif and Serif.

Carl Manaster
Posts: 35
Joined: Tue Mar 28, 2006 1:10 am
Location: La Jolla
Contact:

Yes

Post by Carl Manaster » Tue Oct 17, 2006 7:31 pm

I'm sorry I didn't mention it, but I think the links lay out the problems with this approach. We decided, for our purposes, it was good enough. It looks like the amount of additional work to get uniform sizes and font independence is a lot, and we didn't consider it worth the cost. If we had had to include other characters, beyond the limited set this method supports, I think we'd have made the investment in a more general approach, which would have solved these problems as well. But this, warts and all, is the way we've gone about it; I hope it works for you, too.

hookumsnivy
Posts: 13
Joined: Mon Aug 14, 2006 9:14 pm

Post by hookumsnivy » Tue Oct 17, 2006 10:00 pm

Thanks for the info.

Unfortunately this doesn't work for me so I'm back at square 1. I'm looking into other options. It might be interesting to see if I can change the code to use JLabels to display the text which would then allow me to use basic HTML.

I looked into AttributedString, but it is buggy when it comes to Superscripts and Subscripts.

Locked