GetLegendSize
Prev | PHPlot Function Reference | Next

## GetLegendSize

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

## Synopsis

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

## Description

`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.

## Parameters

None

## 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.

## Notes

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.

## History

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.

Prev | Up | Next
GetDeviceXY | Home | PHPlot