|
How to get the position/size of x/y-axis labels |
Posted by Jo on Aug-08-2016 17:37 |
|
Hello Peter,
is it possible to get the position and size of the text boxes that are containing the x/y-axis labels?
Please refer to the attachment. I am basically interested of the position and size of the marked areas.
It would be helpful to know this in order to avoid overlapping with other elements, like legend boxes, etc.
I am programming in Perl.
Kind regards,
Jo
|
Re: How to get the position/size of x/y-axis labels |
Posted by Peter Kwan on Aug-09-2016 02:16 |
|
Hi Jo,
For your case, a better method is to use XYChart.packPlotArea. This API asks ChartDirector to adjust the plot area size so that the plot area plus the axis labels stay within a given rectangle. There are several examples included in ChartDirector that uses this API. The followings is an example which use this API to make sure the plot area and the legend box fit together without overlapping.
http://www.advsofteng.com/doc/cdperl.htm#missingpoints.htm
If you want to get the "size" of the axis, you can use XYChart.layoutAxes to ask ChartDirector to determine the axis scale and labels first, then use Axis.getThickness to get the axis "thickness". For example:
$c->layoutAxes();
my $axisWidth = $c->yAxis()->getThickness();
Hope this can help.
Regards
Peter Kwan |
|