98 |
- |
1 |
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
|
|
|
2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /><title>SetLegend</title><link rel="stylesheet" type="text/css" href="phplotdoc.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.78.1" /><link rel="home" href="index.html" title="PHPlot Reference Manual" /><link rel="up" href="reference.html" title="PHPlot Function Reference" /><link rel="prev" href="SetLabelScalePosition.html" title="SetLabelScalePosition" /><link rel="next" href="SetLegendBgColor.html" title="SetLegendBgColor" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">SetLegend</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="SetLabelScalePosition.html">Prev</a> </td><th width="60%" align="center">PHPlot Function Reference</th><td width="20%" align="right"> <a accesskey="n" href="SetLegendBgColor.html">Next</a></td></tr></table><hr /></div><div class="refentry"><a id="SetLegend"></a><div class="titlepage"></div><div class="refnamediv"><h2><span class="refentrytitle">SetLegend</span></h2><p>SetLegend — Add text to a legend box</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">$plot->SetLegend(<em class="parameter"><code>$leg</code></em>)</pre></div><div class="refsect1"><a id="idp1378218276"></a><h2>Description</h2><p>
|
|
|
3 |
<code class="function">SetLegend</code> sets the text to be displayed in the legend.
|
|
|
4 |
A legend is often needed when a plot contains more than one data set,
|
|
|
5 |
to identify the purpose of the different data sets being plotted.
|
|
|
6 |
The legend text consists of multiple lines, with each line identifying one
|
|
|
7 |
data set on the plot.
|
|
|
8 |
PHPlot adds an identifying color box or shape marker next to each line in the
|
|
|
9 |
legend.
|
|
|
10 |
</p></div><div class="refsect1"><a id="idp1378219588"></a><h2>Parameters</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>$leg</code></em></span></dt><dd><p>
|
|
|
11 |
An array with each element containing the text for one line of the legend.
|
|
|
12 |
Or, if not an array, the one line to be appended to the legend. See notes.
|
|
|
13 |
</p></dd></dl></div></div><div class="refsect1"><a id="idp1378221196"></a><h2>Notes</h2><p>
|
|
|
14 |
By default, no legend is displayed.
|
|
|
15 |
</p><p>
|
|
|
16 |
The legend usually needs to contain one line of text for each data set plotted
|
|
|
17 |
on the graph, in the same order as the data array.
|
|
|
18 |
You can supply all the legend lines in a single call to SetLegend as an
|
|
|
19 |
array, or you can build up the legend one line at a time with multiple
|
|
|
20 |
calls to SetLegend, supplying one line per call (in the same order as
|
|
|
21 |
the data sets in the data array).
|
|
|
22 |
</p><p>
|
|
|
23 |
By default, legend text lines are displayed in order from top to bottom in
|
|
|
24 |
the legend. (See <a class="xref" href="SetLegendReverse.html" title="SetLegendReverse"><span class="refentrytitle">SetLegendReverse</span></a> to reverse the order.)
|
|
|
25 |
Each line also has a color box or shape maker with the corresponding color from
|
|
|
26 |
the data colors array.
|
|
|
27 |
The colors used in the legend color boxes or shape markers are independent of
|
|
|
28 |
any custom data color callback
|
|
|
29 |
(see <a class="xref" href="adv-datacolor-callback.html" title="4.5. Custom Data Color Selection">Section 4.5, “Custom Data Color Selection”</a>).
|
|
|
30 |
</p><p>
|
|
|
31 |
To cancel a legend (perhaps as part of drawing multiple plots on an image),
|
|
|
32 |
pass an empty array or NULL as <code class="varname">$leg</code>.
|
|
|
33 |
</p><p>
|
|
|
34 |
To control the legend position on the plot,
|
|
|
35 |
use <a class="xref" href="SetLegendPixels.html" title="SetLegendPixels"><span class="refentrytitle">SetLegendPixels</span></a>, <a class="xref" href="SetLegendWorld.html" title="SetLegendWorld"><span class="refentrytitle">SetLegendWorld</span></a>,
|
|
|
36 |
or the more general <a class="xref" href="SetLegendPosition.html" title="SetLegendPosition"><span class="refentrytitle">SetLegendPosition</span></a>.
|
|
|
37 |
You can control the text and color box or shape marker alignment within the
|
|
|
38 |
legend using <a class="xref" href="SetLegendStyle.html" title="SetLegendStyle"><span class="refentrytitle">SetLegendStyle</span></a>.
|
|
|
39 |
</p><p>
|
|
|
40 |
Use <a class="xref" href="SetLegendUseShapes.html" title="SetLegendUseShapes"><span class="refentrytitle">SetLegendUseShapes</span></a> to select color boxes or shape
|
|
|
41 |
markers in the legend.
|
|
|
42 |
</p></div><div class="refsect1"><a id="idp1378226572"></a><h2>History</h2><p>
|
|
|
43 |
Accepting NULL as a valid argument value was added in PHPlot-5.3.1.
|
|
|
44 |
Through PHPlot-5.3.0, passing NULL would cause an error.
|
|
|
45 |
</p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="SetLabelScalePosition.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="reference.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="SetLegendBgColor.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">SetLabelScalePosition </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> SetLegendBgColor</td></tr></table></div></body></html>
|