|
Labels on the x axis are being cut out |
Posted by Pranit on Dec-19-2009 00:09 |
|
I am using chartdirector to create different graphs out of my data.
However while creating a XYChart, my graphs cut the labels on the x axis if they are bigger than a certain length.
I am setting the plot area using setPlotArea(x,y,width,height);
Even by adjusting it with various values I am still not able to get it right.
Any suggestions?
I am attaching a img of one of my graphs, this might help you figure out my problem.
|
Re: Labels on the x axis are being cut out |
Posted by Peter Kwan on Dec-19-2009 01:27 |
|
Hi Pranit,
In your case, the labels are cut off because there is insufficient space under the plot area for the labels. You may either increase the chart height (the height used in new XYChart(www, hhh)), and/or decrease the plot area height (the height used in setPlotArea) to allow to more space under the bottom side of the plot area.
Note that if your labels are arbitrarily long (that is, the label length has no limit and can be infinitely long), there are still chance the labels will be cutoff. All solutions will only work up to a limit.
The most common method is to just allow for sufficient space for the worst case, by reducing the plot area height or increasing the chart height.
Another method is to use packPlotArea to automatically adjust the plot area height to ensure the labels will not be cutoff. The advantage of packPlotArea is that the height is adjusted automatically. The disadvantage is that different charts may appear to have different plot area sizes, because they may contain labels of different lengths.
packPlotArea is a new API introduced in ChartDirector Ver 5. Quite a number of sample code in ChartDirector Ver 5 uses packPlotArea. An example is the "Multi-Symbol Line Chart" sample code.
Hope this can help.
Regards
Peter Kwan |
Re: Labels on the x axis are being cut out |
Posted by Pranit on Dec-19-2009 01:32 |
|
Thanks for the advice Mark. It certainly helps, I appreciate your help. |
Re: Labels on the x axis are being cut out |
Posted by Pranit on Dec-19-2009 01:33 |
|
I am sorry got your name wrong, Thanks Peter |
|