Page 1 of 1

How to create a multiline legend entry

Posted: Thu Dec 16, 2004 2:11 pm
by 5886551
I have a chart with long legend entries. Therefore the width of the chart is smaller than the legend. I would like to keep the legend on the right side of the chart. How can I split the legend entries to two lines? I created the text of the entries during run-time.

Thanks in advance.

Kind regards,

Rolf

Posted: Thu Dec 16, 2004 4:03 pm
by Marjan
Hi, Rolf.

This feature is not yet supported. You'll have to use chart OnGetLegend** events to customize individual legend item position and text. There are some examples about customizing legend items available in TeeChart demo.

Posted: Fri Dec 17, 2004 10:36 am
by 5886551
Hi Marjan,

I didn't find an example with multiline legend entries. My wish is to automate the multiline option: if the string for the legend entry contains a line break it should automatically generate two lines. The only way I see is to use OnGetLegendText:

- Check if there is a line break in the legend entry
- If yes then
1.solution: Increase the space between the entries (Is it only possible for all spaces , not for individual between two entries?) and write the rest of the string in the space (how to do that?).
2.solution: Make additional entries and write the text there. But is it possible to make entries without series? Do I have to create empty series to have additional legend entries? I use checkboxes. Is it possible to hide the checkboxes and legend symbol for some entries?

Maybe you know another, better workaround?

Kind regards,

Rolf

Posted: Fri Dec 17, 2004 12:14 pm
by Pep
Hi Rolf,

the best workaround I can think of, is the custom drawing on the Legend. There's an example in the Demo Features project under All Features -> Welcome ! -> Miscellaneous -> Legend -> Drawing more text