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>SetYDataLabelPos</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="SetYDataLabelAngle.html" title="SetYDataLabelAngle" /><link rel="next" href="SetYDataLabelType.html" title="SetYDataLabelType" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">SetYDataLabelPos</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="SetYDataLabelAngle.html">Prev</a> </td><th width="60%" align="center">PHPlot Function Reference</th><td width="20%" align="right"> <a accesskey="n" href="SetYDataLabelType.html">Next</a></td></tr></table><hr /></div><div class="refentry"><a id="SetYDataLabelPos"></a><div class="titlepage"></div><div class="refnamediv"><h2><span class="refentrytitle">SetYDataLabelPos</span></h2><p>SetYDataLabelPos — Position and control Y data labels</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">$plot->SetYDataLabelPos(<em class="parameter"><code>$ydlp</code></em>)</pre></div><div class="refsect1"><a id="idp1379133396"></a><h2>Description</h2><p>
|
|
|
3 |
<code class="function">SetYDataLabelPos</code> determines if and where Y data labels
|
|
|
4 |
are drawn.
|
|
|
5 |
For horizontal plots, these are Y axis data labels, which display the label
|
|
|
6 |
strings from your data array.
|
|
|
7 |
The labels can be drawn at the left side of the plot (left of the Y axis),
|
|
|
8 |
on the right side, in both positions, or neither.
|
|
|
9 |
For vertical plots, these are Y data value labels, displaying the value of the
|
|
|
10 |
data point within the plot area.
|
|
|
11 |
</p></div><div class="refsect1"><a id="idp1379134748"></a><h2>Parameters</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>$ydlp</code></em></span></dt><dd><p>
|
|
|
12 |
A string indicating the desired position for the Y data labels:
|
|
|
13 |
</p><div class="informaltable"><table summary="Y data label position choices" border="1"><colgroup><col class="c1" /><col class="c2" /></colgroup><thead><tr><th>Position</th><th>Description</th></tr></thead><tbody><tr><td>plotleft</td><td>Data labels left of the plot.
|
|
|
14 |
This is for horizontal plots.</td></tr><tr><td>plotright</td><td>Data labels right of the plot.
|
|
|
15 |
This is for horizontal plots.</td></tr><tr><td>both</td><td>Data labels both left and right of the plot.
|
|
|
16 |
This is for horizontal plots.</td></tr><tr><td>plotin</td><td>Data value labels within the plot area.
|
|
|
17 |
For bar charts, this displays the value above (or
|
|
|
18 |
below) each bar.
|
|
|
19 |
For stacked bar charts, this displays only the bar total
|
|
|
20 |
labels and not the bar segment labels.
|
|
|
21 |
For other plot types, see notes below.
|
|
|
22 |
</td></tr><tr><td>plotstack</td><td>Data value labels above (or below) each bar, and
|
|
|
23 |
below the top of each bar segment.
|
|
|
24 |
This is valid for vertical stacked bar plots only.
|
|
|
25 |
It turns on both bar total labels (as with 'plotin')
|
|
|
26 |
and bar segment labels.
|
|
|
27 |
</td></tr><tr><td>none</td><td>No data labels or data value labels</td></tr></tbody></table></div><p>
|
|
|
28 |
</p></dd></dl></div></div><div class="refsect1"><a id="idp1379143644"></a><h2>Notes</h2><p>
|
|
|
29 |
With vertical plots, this function controls the Y data value labels.
|
|
|
30 |
For examples, see <a class="xref" href="ex-bars4.html#example-bars4" title="Example 5.19. Bar Chart with Data Value Labels">Example 5.19, “Bar Chart with Data Value Labels”</a>,
|
|
|
31 |
<a class="xref" href="ex-stackedbars3.html#example-stackedbars3" title="Example 5.20. Stacked Bars with Y Data Value Labels">Example 5.20, “Stacked Bars with Y Data Value Labels”</a>,
|
|
|
32 |
and <a class="xref" href="ex-linepoints2.html#example-linepoints2" title="Example 5.33. Linepoints Plot with Data Value Labels">Example 5.33, “Linepoints Plot with Data Value Labels”</a>.
|
|
|
33 |
With horizontal plots, this function controls the Y axis data labels.
|
|
|
34 |
For examples, see <a class="xref" href="ex-horizbar.html#example-horizbar" title="Example 5.27. Horizontal Bar Chart">Example 5.27, “Horizontal Bar Chart”</a>
|
|
|
35 |
and <a class="xref" href="ex-horizstackedbar.html#example-horizstackedbar" title="Example 5.28. Horizontal Stacked Bar Chart">Example 5.28, “Horizontal Stacked Bar Chart”</a>,
|
|
|
36 |
where the labels are enabled by default and displayed to the left of the Y axis.
|
|
|
37 |
</p><p>
|
|
|
38 |
The default position for Y data labels (for horizontal plots) is left of the plot.
|
|
|
39 |
However, PHPlot only enables the data labels if SetYDataLabelPos was used to
|
|
|
40 |
position them, or if <a class="xref" href="SetYTickLabelPos.html" title="SetYTickLabelPos"><span class="refentrytitle">SetYTickLabelPos</span></a> was not used to
|
|
|
41 |
enable the tick labels and the data labels are not all empty.
|
|
|
42 |
</p><p>
|
|
|
43 |
The default position for Y data value labels (for vertical plots) is 'none',
|
|
|
44 |
meaning no labels.
|
|
|
45 |
For plot types 'bars' and 'stackedbars', Y data value labels are drawn
|
|
|
46 |
(if enabled) at fixed positions within or above/below the bars.
|
|
|
47 |
For plot types 'lines', 'points', 'linepoints', and 'squared', Y data labels
|
|
|
48 |
are drawn (if enabled) above the data points by default.
|
|
|
49 |
The position can be changed (see <a class="xref" href="adv-tuning.html#adv-tuning-labels" title="4.7.7. Tuning Labels">Section 4.7.7, “Tuning Labels”</a>), but
|
|
|
50 |
PHPlot does not attempt to prevent interference between the labels and
|
|
|
51 |
other plot elements.
|
|
|
52 |
Y data value labels are not available with other plot types.
|
|
|
53 |
</p><p>
|
|
|
54 |
For tick labels, see <a class="xref" href="SetYTickLabelPos.html" title="SetYTickLabelPos"><span class="refentrytitle">SetYTickLabelPos</span></a>.
|
|
|
55 |
</p><p>
|
|
|
56 |
The bar segment labels, if enabled ('plotstack'), are drawn inside the bars
|
|
|
57 |
and may not be very visible if dark colors are used for the bar fill.
|
|
|
58 |
Bar segment labels will be omitted for segments which are too narrow.
|
|
|
59 |
</p><p>
|
|
|
60 |
Y data value labels will be drawn below the bars for negative values.
|
|
|
61 |
This only applies to vertical bar charts.
|
|
|
62 |
Stacked bar charts are not allowed to have negative values.
|
|
|
63 |
</p><p>
|
|
|
64 |
If Y data label lines are enabled with <a class="xref" href="SetDrawYDataLabelLines.html" title="SetDrawYDataLabelLines"><span class="refentrytitle">SetDrawYDataLabelLines</span></a>,
|
|
|
65 |
then SetYDataLabelPos() also determines the direction of the lines which
|
|
|
66 |
are drawn from the data points.
|
|
|
67 |
</p><p>
|
|
|
68 |
The Y data label text angle is set with <a class="xref" href="SetYDataLabelAngle.html" title="SetYDataLabelAngle"><span class="refentrytitle">SetYDataLabelAngle</span></a>.
|
|
|
69 |
The Y data label text format can be controlled with
|
|
|
70 |
<a class="xref" href="SetYDataLabelType.html" title="SetYDataLabelType"><span class="refentrytitle">SetYDataLabelType</span></a> or <a class="xref" href="SetYLabelType.html" title="SetYLabelType"><span class="refentrytitle">SetYLabelType</span></a>.
|
|
|
71 |
</p><p>
|
|
|
72 |
Y data value labels do work with error plots (plot types 'lines', 'points',
|
|
|
73 |
and 'linepoints' and data type
|
|
|
74 |
<a class="link" href="conc-datatypes.html#data-data-error">data-data-error</a>).
|
|
|
75 |
The labels will identify the base Y values of the points.
|
|
|
76 |
However, the default label position above the points will overlap the error
|
|
|
77 |
bars. To prevent this, change the position angle as explained in
|
|
|
78 |
<a class="xref" href="adv-tuning.html#adv-tuning-labels" title="4.7.7. Tuning Labels">Section 4.7.7, “Tuning Labels”</a>). For example:
|
|
|
79 |
</p><pre class="programlisting">// Setup for error plot with data value labels
|
|
|
80 |
$plot->SetDataType('data-data-error');
|
|
|
81 |
$plot->SetYDataLabelPos('plotin');
|
|
|
82 |
$plot->data_value_label_angle = 45; // Position the labels at 45 degrees
|
|
|
83 |
</pre><p>
|
|
|
84 |
</p></div><div class="refsect1"><a id="idp1379153484"></a><h2>History</h2><p>
|
|
|
85 |
Data value labels were first available for error plots in PHPlot-6.0.0.
|
|
|
86 |
</p><p>
|
|
|
87 |
Through PHPlot-5.2.0, data value labels were only available for bars and
|
|
|
88 |
stackedbars plot types.
|
|
|
89 |
Starting with PHPlot-5.3.0, data value labels are also implemented for
|
|
|
90 |
lines, points, linepoints, and squared plot types.
|
|
|
91 |
</p><p>
|
|
|
92 |
Horizontal plot types were added in PHPlot-5.1.2 and PHPlot-5.1.3, and
|
|
|
93 |
the Y Data Labels were extended to include the Y axis data labels for
|
|
|
94 |
horizontal plots in addition to the data value labels for vertical plots.
|
|
|
95 |
</p><p>
|
|
|
96 |
The data value label feature for stacked bar graphs was added in PHPlot-5.1.1.
|
|
|
97 |
</p><p>
|
|
|
98 |
The data value label feature for bar graphs was added to PHPlot-5.0rc3.
|
|
|
99 |
</p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="SetYDataLabelAngle.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="SetYDataLabelType.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">SetYDataLabelAngle </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> SetYDataLabelType</td></tr></table></div></body></html>
|