how to autowrap header text?

TeeChart for ActiveX, COM and ASP
Post Reply
TCubs
Newbie
Newbie
Posts: 6
Joined: Fri Jun 04, 2004 4:00 am
Location: NY

how to autowrap header text?

Post by TCubs » Thu Dec 29, 2005 9:07 pm

Hi,

I need to find out how to autowrap a header text which might be too long for the width of the chart? W/o setting the autowrap on, the header text line gets truncated if it's too long.

Hope I've said the issue clearly enough.

Thanks.

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Sat Dec 31, 2005 1:39 pm

Hi,

you can calculate the width of the Text that must be added and depending on it use more that one line using :

Code: Select all

textWidth = tChart1.Canvas.TextWidth("my text")

With TChart1
    .Header.Text.Remove (0)
    .Header.Text.Add "My First Line"
    .Header.Text.Add "My Second Line"
End With

jonnyg
Newbie
Newbie
Posts: 5
Joined: Fri Feb 22, 2008 12:00 am

how to autowrap header text?

Post by jonnyg » Tue Apr 15, 2008 1:03 am

I do the following in my VC++ code:

Code: Select all

long canvas_width = m_chart.GetCanvas().GetWidth();
long text_width = m_chart.GetCanvas().TextWidth(very_long_text_string);
m_chart.GetHeader().GetText().Add(COleVariant(very_long_text_string));
When I set the header text with the string above, the text goes off the chart on the left and right side. However, the value of canvas_width is greater than text_width. This doesn't make sense to me. How can I accurately compare the header string length against the chart width?

Thanks.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Apr 21, 2008 7:01 am

Hi jonnyg,

Could you please send us a simple example project we can run "as-is" to reproduce the problem here?

You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply