|
Multi-line labels |
Posted by Carey Shaw on Oct-09-2009 20:16 |
|
Hi,
We are using ChartDirector to output some data to a webpage, and are using a Bar Chart. Sometimes, our label for the data is quite lengthy, which when rendered to the chart gets truncated and chopped off. Is there anyway to set a label width with text wrapping so as to display a label over two lines?
Any help would be brilliant
Thanks
Carey Shaw |
Re: Multi-line labels |
Posted by Peter Kwan on Oct-10-2009 01:28 |
|
Hi Carey,
You can set a maximum length for the label using TextBox.setMaxWidth. If the label exceeds the maximum length, it can be wrapped into multiple lines. The exact code depends on your programming language, and what kind of labels you would like to wrap (legend labels, labels inside the bar segment, labels on top of the bars, axis labels, .....). For example, in VB/VBScript, for axis labels, you can use:
'set label style to Arial 8pt. Wrap labels if they are longer than 120 pixels
Call c.xAxis().setLabelStyle("arial.ttf", 8).setMaxWidth(120)
Alternatively, you can also insert linebreaks in the labels yourself if you know where and when to break the line. In VB/VBScript, the linefeed character is vbLF. In many other languages, the linefeed character is "\\n".
Hope this can help.
Regards
Peter Kwan |
|