Title and SubTitle of chart

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
BO
Posts: 61
Joined: Wed Mar 01, 2006 2:17 pm

Title and SubTitle of chart

Post by BO » Thu Oct 22, 2009 8:41 pm

hi
I need to show one subtitle st1 on the left, one subttile st2 on the right
and the title of chart is on the same line like 2nd chart following:

Image

how could I do it ?

thanks
regards
BO

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Re: Title and SubTitle of chart

Post by david.gilbert » Thu Oct 22, 2009 8:48 pm

It is much harder than it ought to be. Prepare for an epic battle with the CompositeTitle class. I don't think there is any demo code around that does what you want.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

BO
Posts: 61
Joined: Wed Mar 01, 2006 2:17 pm

Re: Title and SubTitle of chart

Post by BO » Thu Oct 22, 2009 9:16 pm

i wonder if i could add the 3th sub-title on the middle, and set invisible the main title of chart ...

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Re: Title and SubTitle of chart

Post by david.gilbert » Thu Oct 22, 2009 9:18 pm

Oh, yeah, you have to do that because the main title is a TextTitle and then the subtitles can be any instance of Title. And you have to watch out for the legend which is just a special subtitle.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

BO
Posts: 61
Joined: Wed Mar 01, 2006 2:17 pm

Re: Title and SubTitle of chart

Post by BO » Thu Oct 22, 2009 9:50 pm

David
could u show to me some snippe codes please ?
I have tried but i did not work

(all of subtitles are in the middle , not left - middle - right)

thanks very much
@+

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Re: Title and SubTitle of chart

Post by david.gilbert » Thu Oct 22, 2009 9:54 pm

david.gilbert wrote:I don't think there is any demo code around that does what you want.
AnnotationDemo2 shows a legend on the left and another legend on the right. That's the closest there is...I suspect you will have a bit of fun trying to get a title to display in the middle...the layout logic never got fully exercised, so there are likely bugs and quirks to deal with. Did I mention an "epic battle" before?
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

Locked