Contents
Login Register Wishes Forum About
Language Reference » Misc functions » getLegendSize
Help topics
Latest updates
4615d  replaceImageMapTitle
4615d  replaceImageMapValues
4615d  createFunctionSerie
4615d  setAbsicssaPosition
4615d  negateValues
Toolbox
  Download as PDF
  Print this page
  Share this page
  Create an account
  Feed the updates!
Google AdSense
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.

Basically you‘ll use the same Format array with this function than the one used for the drawLegend() function.

Calling this function
getLegendSize($Format="");
Where :

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.

Sample script

 /* 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
)
Last updated on 01/03/2011 
by Jean-Damien 
Linked resources
  There is no linked topic yet.
Community comments
  No comments have been posted yet.
© Copyrights
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. 415 users have registered. This page has been rendered in 0,20 seconds. Wiki revision 1.37.