Page 1 of 1

how to autowrap header text?

Posted: Thu Dec 29, 2005 9:07 pm
by 9082734
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.

Posted: Sat Dec 31, 2005 1:39 pm
by Pep
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

how to autowrap header text?

Posted: Tue Apr 15, 2008 1:03 am
by 15048390
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.

Posted: Mon Apr 21, 2008 7:01 am
by narcis
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.