GetLegendSize — Return the amount of space required for the legend box


list($width, $height) = $plot->GetLegendSize()


GetLegendSize returns the size (in pixels) required for the legend box. This might be used to adjust the plot margins based on the legend size, for example. After calling GetLegendSize, you can use SetPlotAreaWorld or SetMarginsPixels to leave room for the legend.



Return Value

Returns an array of two values ($width, $height). These are the width and height required for the box containing the legend. Returns FALSE if no legend has been defined.


This function will return valid numbers after the legend has been set up (including using SetLegend to set all the text lines, and optional calls to set the font, linespacing, and style). The results from this function do not depend on data values, plot type, or other plot elements.


Starting with PHPlot-6.0.0, the function returns FALSE if no legend has been defined yet. (In previous versions, the result was undefined if there was no legend defined.)

This function was added in PHPlot-5.4.0. Logo

This version of the manual was produced for the PHPlot Sourceforge project web service site, which requires the logo on each page.

To download a logo-free copy of the manual, see the PHPlot project downloads area.