Language Reference » Misc functions » getLegendSize
getLegendSize- Determine the size of the legend box
This function returns the width and height of the legend box that would be drawn with the specified parameters. You can use this function to align your legend boxes depending of its printed size.
This function will return an associative array containing the Width and Height keys.
Calling this function
Format is an array containing the drawing parameters of the legend.
Customisation array - Tune up your legend!
It is possible to customize the way your legend will be rendered by playing with this array. Providing a detailled configuration is not mandatory, by default the legend will be drawn in a soft grey box with curvy corners.
You can specify the font file that will be used with FontName.
You can specify the font size with FontSize.
You can specify the size of the colored boxes with BoxSize.
You can specify the inner margins with Margin.
You can choose the style that will be applied to you legend box using the Style parameter :
LEGEND_NOBORDER no borders will be drawn around the legend.
LEGEND_BOX a rectangle will be drawn around the legend.
LEGEND_ROUND a rounded rectangle will be drawn around the legend.
You can also define the way the legend will be written using the Mode parameter :
LEGEND_VERTICAL that will stack vertically the series.
LEGEND_HORIZONTAL that will stack horizontally the series.
/* Rounded legend box */ $myPicture->setFontProperties(array("FontName"=>"fonts/pf_arma_five.ttf","FontSize"=>6)); $Size = $myPicture->getLegendSize(array("Style"=>LEGEND_ROUND,"Mode"=>LEGEND_HORIZONTAL)); print_r($Size);The script will returns an associative array :
Array ( [Width] => 123 [Height] => 23 )
Components used on this web site : Famfamfam icons has been made by Mark James, Rounded corners lite has been coded by Cameron Cooke and Tim Hutchison, SyntaxHighlighter has been written by Alex Gorbatchev. pChart and this web site have been created by Jean-Damien POGOLOTTI. This documentation contains 185 pages and 56 comments. 409 users have registered. This page has been rendered in 0,01 seconds. Wiki revision 1.37.