|
Overlaping and exceeding labels |
Posted by Jozin on Feb-09-2011 20:02 |
|
Hi,
is there an easy way to get rid of overlaping labels? For example if I have a pie chart and
too many labels, they are overlaping themselves and are not readable. Im looking for a
method to get rid of that, or do I have to make one myself?
The same problem when I have too long labels, they are exceeding the edge of my chart, so
I see half of them, again is there a method to fix it, or I have to make one myself?
Thank you
Josef |
Re: Overlaping and exceeding labels |
Posted by Peter Kwan on Feb-10-2011 02:46 |
|
Hi Jozin,
If your chart is finite in size, and you put arbitrarily large amount of text in the chart, at some point the text will overlap. It is because this is not possible for a finite chart to contain arbitrarily large amount of visible text without overlapping.
(Unlike a web page which can grow as tall as necessary to contain the text, a chart is usually fixed and finite in size, and therefore it can only support limited amount of text.)
To avoid overlapping labels, the followings are some common methods:
(a) Use "Side Label Layout". (See the sample code "Side Label Layout".) With this method, ChartDirector will move the labels up and down to try it best to avoid overlapping.
(b) Use TextBox.setMaxWidth to set a maximum width to the labels. If a label exceed the width, it will be wrapped to multiple lines. By using a suitable maximum width, you can make sure the labels will not flow outside the left or right edge of the chart. (But the labels can still flow below the bottom edge if there are sufficiently large amount of text.)
For example, in VB/VBScript:
Call c.setLabelStyle("arial", 8).setMaxWidth(80)
(c) Use TextBox.setTruncate to truncate the label if it is too long.
(d) Use only a short label, like a number 1, 2, 3, 4, .... Then put a look up table somewhere in your web page or user interface, so that the user can use the number to look up the actual label. Because the lookup table is part of the web page and can grow indefinitely large, it can contain arbitrarily large amount of text.
Hope this can help.
Regards
Peter Kwan |
|