Subversion Repositories cheapmusic

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
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>Chapter 9. PHPlot Class Internal Functions</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="part3.html" title="Part III. Developer's Guide to PHPlot" /><link rel="prev" href="dev-legend.html" title="Chapter 8. PHPlot Legend Layout" /><link rel="next" href="dev-vars.html" title="Chapter 10. PHPlot Class Member Variables" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 9. PHPlot Class Internal Functions</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="dev-legend.html">Prev</a> </td><th width="60%" align="center">Part III. Developer's Guide to PHPlot</th><td width="20%" align="right"> <a accesskey="n" href="dev-vars.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="dev-internal"></a>Chapter 9. PHPlot Class Internal Functions</h2></div></div></div><div class="abstract"><p class="title"><strong></strong></p><p>
3
This chapter documents PHPlot internal functions. These functions are
4
intended to be used only by PHPlot itself.
5
  </p></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
6
Starting with PHPlot-5.1.0, most of the internal functions are declared as
7
<code class="literal">protected</code>, which limits their visibility to other member
8
functions and inherited or parent classes. Some internal functions are
9
still <code class="literal">public</code>, usually because they are needed for
10
testing PHPlot. However, all functions documented in this chapter should be
11
treated as private, for use only by PHPlot. If you feel you have a need to
12
use one of these functions from outside PHPlot (or an inherited class),
13
please report this via the available PHPlot support mechanisms.
14
  </p></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a id="array_merge_php4"></a>array_merge_php4($array1,$array2)</span></dt><dd><p>
15
This non-member function was removed at PHPlot-5.0.4.
16
    </p></dd><dt><span class="term"><a id="array_pad_array"></a>array_pad_array(&amp;$arr, $size, $arr2=NULL)</span></dt><dd><p>
17
This non-member function was removed at PHPlot-5.0.4 and replaced with
18
the class member function <a class="xref" href="dev-internal.html#pad_array">pad_array</a>.
19
    </p></dd><dt><span class="term"><a id="CalcAxisPositions"></a>CalcAxisPositions()</span></dt><dd><p>
20
Calculates the X and Y axis positions in world coordinates. These can be
21
supplied by the user, in which case they are only changed if they are
22
outside the data range. If axis positions are not supplied by the user,
23
CalcAxisPositions applies defaults as described in
24
<a class="xref" href="SetXAxisPosition.html" title="SetXAxisPosition"><span class="refentrytitle">SetXAxisPosition</span></a> and <a class="xref" href="SetYAxisPosition.html" title="SetYAxisPosition"><span class="refentrytitle">SetYAxisPosition</span></a>.
25
Called by <a class="xref" href="DrawGraph.html" title="DrawGraph"><span class="refentrytitle">DrawGraph</span></a>.
26
Note: This code was moved out of CalcTranslation at PHPlot-5.0.5.
27
    </p></dd><dt><span class="term"><a id="CalcBarWidths"></a>CalcBarWidths($stacked, $verticals)</span></dt><dd><p>
28
Calculates values for <code class="literal">bars</code> and <code class="literal">stackedbars</code>
29
plot types.
30
It calculates the width of the bars and the margins around and between them.
31
An argument was added in PHPlot-5.1.2 to support horizontal plots.
32
Arguments were changed in PHPlot-5.3.0 to explicitly select stacked or
33
grouped bars, and vertical or horizontal plots.
34
This is called by the bar chart drawing functions
35
<a class="xref" href="dev-internal.html#DrawBars">DrawBars</a>, <a class="xref" href="dev-internal.html#DrawStackedBars">DrawStackedBars</a>,
36
<a class="xref" href="dev-internal.html#DrawHorizBars">DrawHorizBars</a>, and <a class="xref" href="dev-internal.html#DrawHorizStackedBars">DrawHorizStackedBars</a>.
37
(Through PHPlot-5.1.2 this was called by <a class="xref" href="DrawGraph.html" title="DrawGraph"><span class="refentrytitle">DrawGraph</span></a> before a
38
bars or stackedbars plot.)
39
    </p></dd><dt><span class="term"><a id="CalcGridSettings"></a>CalcGridSettings()</span></dt><dd><p>
40
This function was removed at PHPlot-6.0.0. It applied the defaults to the X
41
and Y grid flags. PHPlot now uses <a class="xref" href="dev-internal.html#GetGridSetting">GetGridSetting</a> instead.
42
    </p></dd><dt><span class="term"><a id="CalcMargins"></a>CalcMargins($maximize)</span></dt><dd><p>
43
Calculates the size of the four margins around the plot area:
44
x_left_margin, x_right_margin, y_top_margin, and y_bot_margin.
45
It does this by trying to determine how much space is needed for titles,
46
labels, and tick marks.
47
Starting with PHPlot-5.0.5, this is only called by <a class="xref" href="DrawGraph.html" title="DrawGraph"><span class="refentrytitle">DrawGraph</span></a>,
48
and it also calculates position offsets for titles and labels. It is called
49
even in case of a user-supplied plot area (SetPlotAreaPixels or
50
SetMarginsPixels was used). If the $maximize argument is true, then the
51
plot area does not leave room for X or Y axis, labels, or titles; this is
52
used for pie charts.
53
    </p><p>
54
Through PHPlot-5.0.6, all 4 margins are either user-defined or all 4 are
55
automatically calculated. Starting with PHPlot-5.0.7, the 4 margins can be
56
independently set or defaulted to automatic. CalcMargins calculates values
57
for all 4 margins, but only saves those that have not been set using either
58
<a class="xref" href="SetMarginsPixels.html" title="SetMarginsPixels"><span class="refentrytitle">SetMarginsPixels</span></a> or <a class="xref" href="SetPlotAreaPixels.html" title="SetPlotAreaPixels"><span class="refentrytitle">SetPlotAreaPixels</span></a>.
59
Note that other than the overall plot title, elements are drawn relative to
60
the plot area, which is calculated based on the actual margins. If the top
61
margin is increased, for example, the plot title stays at the top of the
62
image, but top tick marks and labels move down against the graph.
63
    </p></dd><dt><span class="term"><a id="CalcMaxDataLabelSize"></a>CalcMaxDataLabelSize($which = 'x')</span></dt><dd><p>
64
Calculates the size of the biggest X or Y data label.
65
For 'x' it returns the height along the Y axis of the tallest data label.
66
For 'y' it returns the width along the sides of the widest data label.
67
This is used to allocate space for margins.
68
This was added to PHPlot-5.0.5.
69
The argument supporting Y label width was added in PHPlot-5.1.2.
70
Called by <a class="xref" href="dev-internal.html#CalcMargins">CalcMargins</a>.
71
    </p></dd><dt><span class="term"><a id="CalcMaxTickLabelSize"></a>CalcMaxTickLabelSize($which)</span></dt><dd><p>
72
Calculates the size of the biggest tick label. The $which argument is 'x'
73
or 'y' to indicate which labels to work with. For 'x', it returns the
74
height along the Y axis; for 'y' it returns the width along the X axis.
75
This is used to allocate space for margins.
76
This was added to PHPlot-5.0.5.
77
Calls <a class="xref" href="dev-internal.html#CalcTicks">CalcTicks</a> to determine the tick value parameters.
78
Called by <a class="xref" href="dev-internal.html#CalcMargins">CalcMargins</a>.
79
    </p></dd><dt><span class="term"><a id="CalcPlotAreaPixels"></a>CalcPlotAreaPixels()</span></dt><dd><p>
80
Calculates the pixel coordinates of the plot area.
81
This was added to PHPlot-5.0.5 by moving the parts of the calculations out of
82
SetPlotAreaPixels and SetMarginsPixels. Those two functions now simply
83
record their arguments, and make no attempt to calculate any parameters.
84
Called by <a class="xref" href="DrawGraph.html" title="DrawGraph"><span class="refentrytitle">DrawGraph</span></a>, after <a class="xref" href="dev-internal.html#CalcMargins">CalcMargins</a>
85
is used to calculate margins.
86
    </p></dd><dt><span class="term"><a id="CalcPlotAreaWorld"></a>CalcPlotAreaWorld()</span></dt><dd><p>
87
Calculates the world coordinate limits of the plot area.
88
This was added to PHPlot-5.0.5 by moving the calculations out of
89
<a class="xref" href="SetPlotAreaWorld.html" title="SetPlotAreaWorld"><span class="refentrytitle">SetPlotAreaWorld</span></a>.
90
Starting with PHPlot-6.0.0, it just calls <a class="xref" href="dev-internal.html#CalcPlotRange">CalcPlotRange</a>
91
twice, once for X and once for Y.
92
Called by <a class="xref" href="DrawGraph.html" title="DrawGraph"><span class="refentrytitle">DrawGraph</span></a>, after <a class="xref" href="dev-internal.html#FindDataLimits">FindDataLimits</a>
93
is used to examine the data array values.
94
    </p></dd><dt><span class="term"><a id="CalcPlotRange"></a>CalcPlotRange($which)</span></dt><dd><p>
95
Calculates the plot range and tick increment. $which is 'x' or 'y', to
96
calculate values for the X or Y axis.
97
Specified values (e.g. with <a class="xref" href="SetPlotAreaWorld.html" title="SetPlotAreaWorld"><span class="refentrytitle">SetPlotAreaWorld</span></a>
98
or <a class="xref" href="SetXTickIncrement.html" title="SetXTickIncrement"><span class="refentrytitle">SetXTickIncrement</span></a>) are used if set. Otherwise, values
99
are calculated heuristically.
100
Returns an array of 3 calculated values: tick_increment, plot_min, and plot_max.
101
This was added in PHPlot-6.0.0.
102
Calls <a class="xref" href="dev-internal.html#CalcStep">CalcStep</a> if necessary to calculate the tick
103
increment. (If either the tick increment or number of ticks has been set,
104
then CalcPlotRange uses those instead of calling CalcStep).
105
Called by <a class="xref" href="dev-internal.html#CalcPlotAreaWorld">CalcPlotAreaWorld</a>, once for X and once for Y.
106
    </p></dd><dt><span class="term"><a id="CalcRangeInit"></a>CalcRangeInit(&amp;$plot_limit, $implied, $data_limit)</span></dt><dd><p>
107
Calculates the initial values for the plot range ends.
108
$plot_limit is one end (min or max) of a plot range. It is passed as a
109
reference because it might be unset. Unset, NULL, or an empty string means
110
this end of the range has not been set and needs to be calculated.
111
$implied is true when the data type does not specify the value (for
112
example, the X value in text-data data type).
113
$data_limit is the actual data limit (min or max) at this end of the range;
114
given no other information this is the initial guess for the plot range limit.
115
Returns an array of 2 elements: the initial value for the plot range limit,
116
and a flag indicating if additional adjustment of that value is to be done.
117
    </p><p>
118
This was added in PHPlot-6.0.0.
119
Called by <a class="xref" href="dev-internal.html#CalcPlotRange">CalcPlotRange</a> 4 times, once for each end of the X
120
and Y ranges.
121
    </p></dd><dt><span class="term"><a id="CalcStep"></a>CalcStep($which, $range)</span></dt><dd><p>
122
Calculates an appropriate tick increment.
123
$which is 'x' or 'y', and selects configuration variables for that axis.
124
$range is the plot area range (max - min).
125
Returns the calculated tick increment.
126
    </p><p>
127
This function is not called if the user has set a tick increment
128
(<a class="xref" href="SetXTickIncrement.html" title="SetXTickIncrement"><span class="refentrytitle">SetXTickIncrement</span></a>, <a class="xref" href="SetYTickIncrement.html" title="SetYTickIncrement"><span class="refentrytitle">SetYTickIncrement</span></a>)
129
or the number of tick marks
130
(<a class="xref" href="SetNumXTicks.html" title="SetNumXTicks"><span class="refentrytitle">SetNumXTicks</span></a>, <a class="xref" href="SetNumYTicks.html" title="SetNumYTicks"><span class="refentrytitle">SetNumYTicks</span></a>).
131
This function calls either <a class="xref" href="dev-internal.html#CalcStep125">CalcStep125</a>,
132
<a class="xref" href="dev-internal.html#CalcStepBinary">CalcStepBinary</a>, or <a class="xref" href="dev-internal.html#CalcStepDatetime">CalcStepDatetime</a>
133
to calculate an appropriate value, depending on the tick increment mode.
134
This was added in PHPlot-6.0.0.
135
Called by <a class="xref" href="dev-internal.html#CalcPlotRange">CalcPlotRange</a>.
136
    </p></dd><dt><span class="term"><a id="CalcStep125"></a>CalcStep125($range, $min_ticks)</span></dt><dd><p>
137
Calculates an appropriate tick increment in 'decimal' mode. This is the
138
default mode.
139
$range is the plot area range (max - min).
140
$min_ticks is the minimum number of tick intervals to produce.
141
Returns the calculated tick increment.
142
The algorithm produces the largest tick increment that is a power of 10
143
times 1, 2, or 5, and divides the plot area range $range into no fewer than
144
$min_ticks intervals.
145
This was added in PHPlot-6.0.0.
146
Called by <a class="xref" href="dev-internal.html#CalcStep">CalcStep</a>.
147
    </p></dd><dt><span class="term"><a id="CalcStepBinary"></a>CalcStepBinary($range, $min_ticks)</span></dt><dd><p>
148
Calculates an appropriate tick increment in 'binary' (power of 2) mode.
149
$range is the plot area range (max - min).
150
$min_ticks is the minimum number of tick intervals to produce.
151
Returns the calculated tick increment.
152
The algorithm produces the largest tick increment that is a power of 2
153
and divides the plot area range $range into no fewer than $min_ticks intervals.
154
This was added in PHPlot-6.0.0.
155
Called by <a class="xref" href="dev-internal.html#CalcStep">CalcStep</a>.
156
    </p></dd><dt><span class="term"><a id="CalcStepDatetime"></a>CalcStepDatetime($range, $min_ticks)</span></dt><dd><p>
157
Calculates an appropriate tick increment in 'date' mode.
158
This is for when the values along the axis represent date/time values.
159
$range is the plot area range (max - min), in seconds.
160
$min_ticks is the minimum number of tick intervals to produce.
161
Returns the calculated tick increment.
162
The function contains a list of acceptable intervals between 1 second and 1
163
week, and returns one of those if possible - the largest value that divides
164
the plot area range $range into no fewer than $min_ticks intervals.  If the
165
range is too large (would produce too many ticks with an increment of 1
166
week), the function falls back to using <a class="xref" href="dev-internal.html#CalcStep125">CalcStep125</a> with
167
units of 1 day.
168
This was added in PHPlot-6.0.0.
169
Called by <a class="xref" href="dev-internal.html#CalcStep">CalcStep</a>.
170
    </p></dd><dt><span class="term"><a id="CalcTicks"></a>CalcTicks($which)</span></dt><dd><p>
171
Gets the tick parameters. $which is 'x' or 'y'. Returns an array of 3
172
values: start, end, and interval.
173
This was added to PHPlot-5.0.5, although still using the method
174
of just dividing the interval by 10 if there is no user-supplied interval
175
or tick count.
176
Starting with PHPlot-5.4.0, it also accounts for a tick anchor value, by
177
shifting the start value as needed.
178
Starting in PHPlot-6.0.0, it no longer calculates the tick increment, but
179
simply uses the values calculated by <a class="xref" href="dev-internal.html#CalcPlotRange">CalcPlotRange</a>.
180
Called by <a class="xref" href="dev-internal.html#CalcMaxTickLabelSize">CalcMaxTickLabelSize</a>,
181
<a class="xref" href="dev-internal.html#DrawYTicks">DrawYTicks</a>, and <a class="xref" href="dev-internal.html#DrawXTicks">DrawXTicks</a>.
182
    </p></dd><dt><span class="term"><a id="CalcTranslation"></a>CalcTranslation()</span></dt><dd><p>
183
Calculates the parameters for transforming world to pixel coordinates.
184
This function calculates the scale (xscale, yscale) and origin
185
(plot_origin_x, plot_origin_y) for X and Y translations, which
186
are used by the xtr() and ytr() functions.
187
Starting with PHPlot-5.0.5, this is only called by <a class="xref" href="DrawGraph.html" title="DrawGraph"><span class="refentrytitle">DrawGraph</span></a>,
188
as nothing else uses the parameters until the graph is ready to be drawn.
189
    </p></dd><dt><span class="term"><a id="CheckDataArray"></a>CheckDataArray()</span></dt><dd><p>
190
Checks that there is a valid data array for the plot, and calculates values
191
that depend on the data type.
192
Called very early by <a class="xref" href="DrawGraph.html" title="DrawGraph"><span class="refentrytitle">DrawGraph</span></a>.
193
This was added in PHPlot-5.1.3, moving the checking out of DrawGraph
194
and adding the data_columns calculation.
195
    </p></dd><dt><span class="term"><a id="CheckDataType"></a>CheckDataType($valid_types)</span></dt><dd><p>
196
Used to validate the data_type for a plot_type. This works like a specialized
197
version of <a class="xref" href="dev-internal.html#CheckOption">CheckOption</a>.  $valid_types contains the valid
198
data type(s) for the current plot_type, separated by a comma and space if more
199
than one is supported. If the current data_type is in the list, returns TRUE,
200
else produces an error.  This was added in PHPlot-5.1.2 to unify the way
201
the plot drawing functions check the data type.
202
    </p></dd><dt><span class="term"><a id="CheckDataValueLabels"></a>CheckDataValueLabels($label_control, &amp;$dvl)</span></dt><dd><p>
203
Checks to see if data value labels should be drawn, based on $label_control
204
(which is either <code class="literal">$this-&gt;y_data_label_pos</code> for vertical plots,
205
or <code class="literal">$this-&gt;x_data_label_pos</code> for horizontal plots).
206
Returns FALSE if the labels are off, else returns TRUE and sets 4 variables
207
in the $dvl array. This array is used by <a class="xref" href="dev-internal.html#DrawDataValueLabel">DrawDataValueLabel</a>
208
to position the label. The array contains these keys: x_offset, y_offset :
209
device coordinate (pixel) offsets for the label; h_align, v_align :
210
text alignment.
211
Called by plot type drawing functions such as <a class="xref" href="dev-internal.html#DrawDots">DrawDots</a>
212
which do data value labels, other than bars and stackedbars.
213
This was added in PHPlot-5.3.0.
214
Through PHPlot-5.7.0, four separate reference arguments were used for the
215
return values, instead of an array.
216
    </p></dd><dt><span class="term"><a id="CheckLabels"></a>CheckLabels()</span></dt><dd><p>
217
Fixes up the data and tick label position and angle.
218
This applies defaults to data label and tick label positions but avoids
219
having them overlap unless the user deliberately positioned them that way.
220
Also sets the default angle for X data labels.
221
This is for compatibility with PHPlot-5.0.7 and earlier, when there was only
222
one control for both types of labels.
223
Called by <a class="xref" href="DrawGraph.html" title="DrawGraph"><span class="refentrytitle">DrawGraph</span></a> before calculating margins with
224
<a class="xref" href="dev-internal.html#CalcMargins">CalcMargins</a>.
225
This was added in PHPlot-5.1.0.
226
Before PHPlot-6.0.0, it also applied tick label format settings as
227
defaults for data label formatting. Starting with PHPlot-6.0.0, this
228
is now handled in <a class="xref" href="dev-internal.html#FormatLabel">FormatLabel</a> instead.
229
    </p></dd><dt><span class="term"><a id="CheckLabelsAllEmpty"></a>CheckLabelsAllEmpty()</span></dt><dd><p>
230
Returns TRUE if all of the labels in the data array are empty strings.
231
This is used by <a class="xref" href="dev-internal.html#CheckLabels">CheckLabels</a> to determine whether tick or
232
axis data labels should default on if both are left off.
233
This was added in PHPlot-5.1.2.
234
    </p></dd><dt><span class="term"><a id="CheckOption"></a>CheckOption($which_opt, $which_acc, $which_func)</span></dt><dd><p>
235
Checks the validity of an option passed to a PHPlot member function.
236
$which_opt is the string to check, and $which_acc is a string of acceptable
237
choices (with a comma and then a space between choices).
238
If the string to check is not found in the string of acceptable choices, a
239
fatal error will be reported using <a class="xref" href="dev-internal.html#PrintError">PrintError</a>.
240
The error message will include $which_func which should
241
be the name of the calling function (using the PHP __FUNCTION__ magic constant).
242
Note that this is used to catch programming errors, not run-time or user errors.
243
If the string to check is acceptable, it is returned down-cased and trimmed
244
of leading and trailing spaces.
245
Note: At PHPlot-5.0.5, this function was changed to require exactly ', '
246
(comma space) between acceptable choices, and reject empty strings for
247
$which_opt and disallow partial matches.
248
    </p></dd><dt><span class="term"><a id="CheckOptionArray"></a>CheckOptionArray($opt, $acc, $func)</span></dt><dd><p>
249
Checks the validity of an option argument passed to a PHPlot member function
250
that can accept its argument as either a string or an array of strings.
251
$opt is the string or array to check, and $acc is a string of acceptable
252
choices (with a comma and then a space between choices).
253
If the $opt argument is supplied as a string, it is first converted to an
254
array with one element. Then the elements of the array are each checked
255
for validity. If any element of the array of strings to check is not
256
found in the string of acceptable choices, a fatal error will be reported
257
using <a class="xref" href="dev-internal.html#PrintError">PrintError</a>.  The error message will include $func
258
which should be the name of the calling function (using the PHP
259
__FUNCTION__ magic constant).  Note that this is used to catch programming
260
errors, not run-time or user errors.  If all of the array elements to check
261
are acceptable, the array is returned with each element down-cased and
262
trimmed of leading and trailing spaces.  Note that an array is always
263
returned, even if the opt argument is a string.
264
This was added in PHPlot-5.1.2.
265
    </p></dd><dt><span class="term"><a id="CheckPieLabels"></a>CheckPieLabels()</span></dt><dd><p>
266
Sets up the default pie chart label type and format. The default is percentage
267
labels formatted as 'data' (fixed-point). The default cannot be statically
268
defined, for compatibility with previous releases which used the Y label
269
precision (if set), else 1 digit if <a class="xref" href="SetPrecisionY.html" title="SetPrecisionY"><span class="refentrytitle">SetPrecisionY</span></a>
270
was never called.
271
Called by <a class="xref" href="dev-internal.html#DrawPieChart">DrawPieChart</a>.
272
This was added in PHPlot-5.6.0.
273
    </p></dd><dt><span class="term"><a id="CheckPlotRange"></a>CheckPlotRange($which, &amp;$plot_min, &amp;$plot_max, $adjust_min, $adjust_max)</span></dt><dd><p>
274
Ensures that the X or Y plot range is positive.  This is necessary because the
275
plot range and tick increment calculations, as well as the overall plotting
276
functions, cannot handle zero or negative ranges.
277
A bad range can happen as a result of 'flat' or missing data (all Y values
278
the same, for example), or if <a class="xref" href="SetPlotAreaWorld.html" title="SetPlotAreaWorld"><span class="refentrytitle">SetPlotAreaWorld</span></a> is used to
279
set one end of the data range, and the actual data is on the wrong side of
280
that limit. (<code class="function">SetPlotAreaWorld</code> itself defends against
281
setting both ends of a range such that min &gt;= max).
282
PHPlot will never adjust user-set plot limits, but it will adjust its own
283
calculated limits to force a positive range (even if the resulting plot may
284
not be useful).
285
    </p><p>
286
$which is 'x' or 'y' (this is only used for error reporting).
287
$plot_min and $plot_max are the range limits. These are passed by reference
288
and may be adjusted by the function.
289
$adjust_min and $adjust_max are flags indicating if the corresponding
290
$plot_min and $plot_max values were user-specified (False) or calculated (True).
291
A flag value of True means <code class="function">CheckPlotRange</code> may adjust
292
the corresponding plot range value to prevent a non-positive range.
293
Called by <a class="xref" href="dev-internal.html#CalcPlotRange">CalcPlotRange</a>.
294
This was added in PHPlot-6.0.0.
295
    </p></dd><dt><span class="term"><a id="CheckPointParams"></a>CheckPointParams()</span></dt><dd><p>
296
Adjusts the point_shapes and point_sizes arrays so they have the same size,
297
and stores the size in a class variable. This handles processing deferred
298
from <a class="xref" href="SetPointShapes.html" title="SetPointShapes"><span class="refentrytitle">SetPointShapes</span></a> and <a class="xref" href="SetPointSizes.html" title="SetPointSizes"><span class="refentrytitle">SetPointSizes</span></a>
299
until graph drawing time. It it is called by <a class="xref" href="dev-internal.html#DrawDots">DrawDots</a>
300
before using point shapes.
301
This was added in PHPlot-5.1.0.
302
    </p></dd><dt><span class="term"><a id="DecodeDataType"></a>DecodeDataType()</span></dt><dd><p>
303
Decodes the data type, and sets several member variables that other functions
304
can use to understand how to process the data array. The variables it sets
305
all have names starting with "datatype_" (refer to <a class="xref" href="dev-vars.html" title="Chapter 10. PHPlot Class Member Variables">Chapter 10, <em>PHPlot Class Member Variables</em></a>).
306
This is called by <a class="xref" href="DrawGraph.html" title="DrawGraph"><span class="refentrytitle">DrawGraph</span></a>.
307
It was added in PHPlot-5.1.2 (where it returned an array of 4 flags, and
308
was called by several functions that needed to know the structure of the
309
data array.)
310
In PHPlot-5.1.3, it was changed to set member variables instead.
311
It is now called just once, and the other functions reference the variables
312
as needed.
313
Starting with PHPlot-6.1.0, it uses the
314
<a class="link" href="dev-var-notes.html#var-datatypes" title="10.2.1. datatypes[]">$datatypes</a> array to set the flags based
315
on the data type, so it no longer needs to 'know' the actual data type names.
316
    </p></dd><dt><span class="term"><a id="DisableCaching"></a>DisableCaching()</span></dt><dd><p>
317
Sends HTTP headers to the browser to disable client-side caching.  This is
318
called by <a class="xref" href="PrintImage.html" title="PrintImage"><span class="refentrytitle">PrintImage</span></a> if
319
<a class="xref" href="SetBrowserCache.html" title="SetBrowserCache"><span class="refentrytitle">SetBrowserCache</span></a> was used to disable caching.
320
It is also used by <a class="xref" href="StartStream.html" title="StartStream"><span class="refentrytitle">StartStream</span></a>.
321
This was added in PHPlot-5.8.0 by moving code out of PrintImage.
322
    </p></dd><dt><span class="term"><a id="DoCallback"></a>DoCallback($reason, ...)</span></dt><dd><p>
323
Call a callback (hook) function.  $reason is the name given to the
324
callback, for example <code class="literal">draw_titles</code>
325
(meaning: call after drawing titles).
326
The reasons are array indexes in the $callbacks class variable. Following
327
that are zero or more arguments to pass to the callback, after the image
328
resource and passthrough arguments. DoCallback does nothing if there is no
329
callback registered for the given reason, otherwise it calls the callback
330
function. See <a class="xref" href="callbacks.html" title="4.4. Callbacks">Section 4.4, &#8220;Callbacks&#8221;</a> for more information on callbacks.
331
    </p><p>
332
Starting with PHPlot-5.1.3, <code class="function">DoCallback</code> returns the value
333
returned by the callback function, if any. If there is no callback defined for
334
the given reason,  <code class="literal">NULL</code> is returned. So it is possible to
335
define a callback that returns a meaningful value (such as True/False), and
336
still distinguish the case of where no callback has been set.  However, it is
337
often simpler to test first to see if a callback has been set, using
338
<a class="xref" href="GetCallback.html" title="GetCallback"><span class="refentrytitle">GetCallback</span></a>, before using <code class="function">DoCallback</code>.
339
    </p></dd><dt><span class="term"><a id="DrawArea"></a>DrawArea($do_stacked = False)</span></dt><dd><p>
340
Draws an area plot, or a stacked area plot (if the optional argument is True).
341
Called by <a class="xref" href="DrawGraph.html" title="DrawGraph"><span class="refentrytitle">DrawGraph</span></a> when the plot type is
342
<a class="link" href="conc-plottypes.html#plottype-area" title="3.4.1. Plot Type: area (Area Plot)">area</a> or
343
<a class="link" href="conc-plottypes.html#plottype-stackedarea" title="3.4.14. Plot Type: stackedarea (Stacked Area Plot)">stackedarea</a>.
344
Stacked area plots were added in PHPlot-5.1.1; through PHPlot-5.1.0 this
345
function did not have a parameter and was used only for area plots.
346
    </p></dd><dt><span class="term"><a id="DrawBackground"></a>DrawBackground($overwrite = False)</span></dt><dd><p>
347
Draws the image background, either an image file or solid fill or nothing.
348
Called by <a class="xref" href="DrawGraph.html" title="DrawGraph"><span class="refentrytitle">DrawGraph</span></a> and <a class="xref" href="DrawMessage.html" title="DrawMessage"><span class="refentrytitle">DrawMessage</span></a>.
349
The optional argument $overwrite (added in PHPlot-5.7.0 for DrawMessage)
350
forces the background to be drawn, even if it was already drawn.
351
    </p></dd><dt><span class="term"><a id="DrawBar"></a>DrawBar($row, $column, $x1, $y1, $x2, $y2, $data_color, $shade_color, $border_color, $shade_top = TRUE, $shade_side = TRUE)</span></dt><dd><p>
352
Draws a single bar (or bar segment), with either shading or border.
353
The $row and $column indicate which data point is being plotted.
354
Four corner coordinates and 3 color indexes are provided.
355
The first color $data_color is the bar fill color,
356
the second color $shade_color is the shading color, and the third
357
color $border_color is used for bar borders.
358
(These three come from <a class="xref" href="dev-internal.html#GetBarColors">GetBarColors</a>.)
359
The last two arguments are flags used to suppress the top or side shading
360
for certain cases of stacked bar segments.
361
Called by <a class="xref" href="dev-internal.html#DrawBars">DrawBars</a> and <a class="xref" href="dev-internal.html#DrawHorizBars">DrawHorizBars</a>
362
to draw each bar.
363
Called by <a class="xref" href="dev-internal.html#DrawStackedBars">DrawStackedBars</a> and
364
<a class="xref" href="dev-internal.html#DrawHorizStackedBars">DrawHorizStackedBars</a> to draw each bar segment.
365
This was added in PHPlot-5.2.0, moving common code from those 4 functions.
366
    </p><p>
367
Starting with PHPlot-5.7.0, the arguments were changed as shown to accommodate
368
a new callback which provides access to drawing coordinates.
369
In previous releases, the usage was
370
<code class="function">DrawBar($x1, $y1, $x2, $y2, $data_color, $alt_color,
371
$shade_top = TRUE, $shade_side = TRUE)</code>.
372
    </p><p>
373
In PHPlot-6.0.0, a single $alt_color argument was split into separate
374
$shade_color and $border_color arguments. This corresponds to the change
375
in <a class="xref" href="dev-internal.html#GetBarColors">GetBarColors</a>, and allows for bar charts with
376
independent control over shading and borders.
377
    </p></dd><dt><span class="term"><a id="DrawBars"></a>DrawBars()</span></dt><dd><p>
378
Draws a bar chart plot.
379
Called by <a class="xref" href="DrawGraph.html" title="DrawGraph"><span class="refentrytitle">DrawGraph</span></a> when the plot type is
380
<a class="link" href="conc-plottypes.html#plottype-bars" title="3.4.2. Plot Type: bars (Bar Plot)">bars</a>.
381
If the data type indicates a horizontal bar chart,
382
calls <a class="xref" href="dev-internal.html#DrawHorizBars">DrawHorizBars</a> instead.
383
    </p></dd><dt><span class="term"><a id="DrawBoxes"></a>DrawBoxes()</span></dt><dd><p>
384
Draws a box plot.
385
Called by <a class="xref" href="DrawGraph.html" title="DrawGraph"><span class="refentrytitle">DrawGraph</span></a> when the plot type is
386
<a class="link" href="conc-plottypes.html#plottype-boxes" title="3.4.3. Plot Type: boxes (Box Plot)">boxes</a>.
387
This was added in PHPlot-6.1.0.
388
    </p></dd><dt><span class="term"><a id="DrawBubbles"></a>DrawBubbles()</span></dt><dd><p>
389
Draws a bubbles plot.
390
Called by <a class="xref" href="DrawGraph.html" title="DrawGraph"><span class="refentrytitle">DrawGraph</span></a> when the plot type is
391
<a class="link" href="conc-plottypes.html#plottype-bubbles" title="3.4.4. Plot Type: bubbles (Bubble Plot)">bubbles</a>.
392
This was added in PHPlot-5.5.0.
393
    </p></dd><dt><span class="term"><a id="DrawDataLabel"></a>DrawDataLabel($which_font, $which_angle, $x_world, $y_world, $which_color, $which_text, $which_halign = 'center', $which_valign = 'top', $x_adjustment=0, $y_adjustment=0)</span></dt><dd><p>
394
This function was removed in PHPlot-5.1.3 and replaced
395
by <a class="xref" href="dev-internal.html#DrawDataValueLabel">DrawDataValueLabel</a>.
396
    </p></dd><dt><span class="term"><a id="DrawDataValueLabel"></a>DrawDataValueLabel($x_or_y, $row, $column, $x_world, $y_world, $text, $dvl)</span></dt><dd><p>
397
Draws a data value label (previously called "Y data label").
398
These are the above-bar or in-bar labels on bar and stackedbar charts, and
399
the labels near data points available with some other plot types.
400
</p><p>
401
$x_or_y is 'x' or 'y' to select the font, angle, and formatting type.
402
The $row and $column are passed to <a class="xref" href="dev-internal.html#FormatLabel">FormatLabel</a>
403
for possible use with a custom formatting function.
404
The label is drawn at world coordinates ($x_world, $y_world) after device
405
coordinate offset is applied (see below).
406
$text is the label text, which gets formatted with
407
<a class="xref" href="dev-internal.html#FormatLabel">FormatLabel</a> before drawing.
408
</p><p>
409
The $dvl argument is an array with up to 6 variables containing positioning
410
and related information. In $dvl, x_offset and y_offset are pixel offsets
411
for the label; h_align and v_align specify the text alignment relative
412
to the plotting point (see <a class="xref" href="dev-internal.html#DrawText">DrawText</a>);
413
min_width and max_width used to prevent labels from overlapping their
414
allocated space. If either min_width or max_width is supplied in the $dvl
415
array, the text is sized before drawing, and if it won't fit in the space
416
the label is not drawn. This is used to suppress labels that are too wide to
417
be drawn inside their bars, for example.
418
The defaults for the X and Y offsets are 0, and the default alignment is
419
(center, center). (The $dvl argument is required, but none of its elements
420
is required.)
421
</p><p>
422
This function is called by all plot drawing functions which support data value
423
labels, if those labels are enabled.
424
</p><p>
425
This function was added in PHPlot-5.1.3 and replaced
426
<a class="xref" href="dev-internal.html#DrawDataLabel">DrawDataLabel</a>.
427
Through PHPlot-5.7.0, 6 separate arguments were used instead of the $dvl
428
array, and the $row and $column arguments were not present.
429
    </p></dd><dt><span class="term"><a id="DrawDot"></a>DrawDot($row, $column, $x_world, $y_world, $color)</span></dt><dd><p>
430
Draws a single marker point ('dot') at the given X and Y world coordinates,
431
using the given color.
432
The $row and $column indicate which data point is being plotted.
433
The $column parameter also selects the marker shape and size,
434
using the arrays set up with SetPointSizes() and SetPointShapes().
435
Called by <a class="xref" href="dev-internal.html#DrawDots">DrawDots</a> to plot point markers.
436
Starting with PHPlot-5.4.0, DrawDot() simply converts the coordinates to device
437
coordinates and then calls <a class="xref" href="dev-internal.html#DrawShape">DrawShape</a>. It has no knowledge of
438
the available dot shapes.
439
    </p><p>
440
Starting with PHPlot-5.7.0, the arguments were changed as shown to accommodate
441
a new callback which provides access to drawing coordinates.
442
In previous releases, the usage was
443
<code class="function">DrawDot($x_world, $y_world, $record, $color)</code>.
444
The old $record argument is equivalent to the new $column argument.
445
    </p></dd><dt><span class="term"><a id="DrawDots"></a>DrawDots($paired = False)</span></dt><dd><p>
446
Draws a points plot, or the points for a linepoints plot, including error plots.
447
Called by <a class="xref" href="DrawGraph.html" title="DrawGraph"><span class="refentrytitle">DrawGraph</span></a> when the plot type is
448
<a class="link" href="conc-plottypes.html#plottype-points" title="3.4.11. Plot Type: points (Styled Dot Plot)">points</a>,
449
and by <a class="xref" href="dev-internal.html#DrawLinePoints">DrawLinePoints</a> for the
450
points portion of a <a class="link" href="conc-plottypes.html#plottype-linepoints" title="3.4.7. Plot Type: linepoints (Lines and Points Plot)">linepoints</a> plot.
451
$paired is true for <code class="literal">linepoints</code> plots.
452
When $paired is true, DrawDots() draws the points and error bars, and
453
<a class="xref" href="dev-internal.html#DrawLines">DrawLines</a> draws the lines and data labels.
454
(The $paired argument was added in PHPlot-5.1.3.)
455
Starting with PHPlot-6.0.0, DrawDots() also handles error plots,
456
and horizontal points and linepoints plots.
457
    </p></dd><dt><span class="term"><a id="DrawDotsError"></a>DrawDotsError($paired = False)</span></dt><dd><p>
458
This function was removed in PHPlot-6.0.0 and merged into
459
<a class="xref" href="dev-internal.html#DrawDots">DrawDots</a>.
460
    </p></dd><dt><span class="term"><a id="DrawError"></a>DrawError($error_message, [$where_x], [$where_y])</span></dt><dd><p>
461
Starting with PHPlot-5.0.5, this function is an alias for
462
<a class="xref" href="dev-internal.html#PrintError">PrintError</a> and is retained for compatibility.
463
The $where_x and $where_arguments are now ignored. (Previously they
464
positioned the error message on the image, but were never used.)
465
Starting with PHPlot-5.7.0, this function is considered deprecated.
466
    </p></dd><dt><span class="term"><a id="DrawHorizBars"></a>DrawHorizBars()</span></dt><dd><p>
467
Draws a horizontal bars plot.
468
Called by <a class="xref" href="dev-internal.html#DrawBars">DrawBars</a> when the data type indicates a
469
horizontal plot.
470
This was added in PHPlot-5.1.2 (but was called by DrawGraph).
471
In PHPlot-5.1.3 it was changed to be called by DrawBars.
472
    </p></dd><dt><span class="term"><a id="DrawHorizStackedBars"></a>DrawHorizStackedBars()</span></dt><dd><p>
473
Draws a horizontal stacked bars plot.
474
Called by <a class="xref" href="dev-internal.html#DrawStackedBars">DrawStackedBars</a> when the data type indicates a
475
horizontal plot.
476
This was added in PHPlot-5.1.3.
477
    </p></dd><dt><span class="term"><a id="DrawImageBorder"></a>DrawImageBorder($overwrite = False)</span></dt><dd><p>
478
Draws a border around the image, if enabled by
479
<a class="xref" href="SetImageBorderType.html" title="SetImageBorderType"><span class="refentrytitle">SetImageBorderType</span></a>.
480
Called by <a class="xref" href="DrawGraph.html" title="DrawGraph"><span class="refentrytitle">DrawGraph</span></a> and <a class="xref" href="DrawMessage.html" title="DrawMessage"><span class="refentrytitle">DrawMessage</span></a>.
481
The optional argument $overwrite (added in PHPlot-5.7.0 for DrawMessage)
482
forces the border to be drawn, even if it was already drawn.
483
    </p></dd><dt><span class="term"><a id="DrawLegend"></a>DrawLegend(x,y,type)</span></dt><dd><p>
484
Draws the plot legend. This includes the box, text labels, and color boxes
485
or shapes.
486
Called by <a class="xref" href="DrawGraph.html" title="DrawGraph"><span class="refentrytitle">DrawGraph</span></a>,
487
but only if legend text has been set using <a class="xref" href="SetLegend.html" title="SetLegend"><span class="refentrytitle">SetLegend</span></a>.
488
    </p></dd><dt><span class="term"><a id="DrawLinePoints"></a>DrawLinePoints()</span></dt><dd><p>
489
Draws a linepoints plot, with or without error bars.
490
Called by <a class="xref" href="DrawGraph.html" title="DrawGraph"><span class="refentrytitle">DrawGraph</span></a> when the plot type is
491
<a class="link" href="conc-plottypes.html#plottype-linepoints" title="3.4.7. Plot Type: linepoints (Lines and Points Plot)">linepoints</a>.
492
It simply calls <a class="xref" href="dev-internal.html#DrawLines">DrawLines</a> and <a class="xref" href="dev-internal.html#DrawDots">DrawDots</a>,
493
which handle both the plain and error bar cases.
494
This was added in PHPlot-5.1.3 to provide a function specific to this
495
plot type.
496
    </p></dd><dt><span class="term"><a id="DrawLines"></a>DrawLines($paired = False)</span></dt><dd><p>
497
Draws a line plot, or the lines part of a linepoints plot, including error
498
plots.
499
Called by <a class="xref" href="DrawGraph.html" title="DrawGraph"><span class="refentrytitle">DrawGraph</span></a> when the plot type is
500
<a class="link" href="conc-plottypes.html#plottype-lines" title="3.4.8. Plot Type: lines (Lines Plot)">lines</a>, and by
501
<a class="xref" href="dev-internal.html#DrawLinePoints">DrawLinePoints</a> for the
502
lines portion of a <a class="link" href="conc-plottypes.html#plottype-linepoints" title="3.4.7. Plot Type: linepoints (Lines and Points Plot)">linepoints</a> plot.
503
$paired is true for <code class="literal">linepoints</code> plots.
504
When $paired is true, DrawLines() draws the lines and data labels, and
505
<a class="xref" href="dev-internal.html#DrawDots">DrawDots</a> draw the points and error bars.
506
(The $paired argument was added in PHPlot-5.1.3.)
507
Starting with PHPlot-6.0.0, DrawLines() also handles error plots,
508
and horizontal lines and linepoints plots.
509
    </p></dd><dt><span class="term"><a id="DrawLinesError"></a>DrawLinesError($paired = False)</span></dt><dd><p>
510
This function was removed in PHPlot-6.0.0 and merged into
511
<a class="xref" href="dev-internal.html#DrawLines">DrawLines</a>.
512
    </p></dd><dt><span class="term"><a id="DrawOHLC"></a>DrawOHLC($draw_candles, $always_fill = FALSE)</span></dt><dd><p>
513
Draws one of the three types of OHLC (Open/High/Low/Close) plots.
514
If $draw_candles is FALSE, draws a basic OHLC plot
515
(plot type <a class="link" href="conc-plottypes.html#plottype-ohlc" title="3.4.9. Plot Type: ohlc (Basic OHLC Plot)">ohlc</a>).
516
If $draw_candles is TRUE and $always_fill is FALSE,
517
draws a candlestick OHLC plot
518
(plot type <a class="link" href="conc-plottypes.html#plottype-candlesticks" title="3.4.5. Plot Type: candlesticks (OHLC Candlesticks Plot)">candlesticks</a>).
519
If $draw_candles is TRUE and $always_fill is TRUE,
520
draws a filled candlestick OHLC plot
521
(plot type <a class="link" href="conc-plottypes.html#plottype-candlesticks2" title="3.4.6. Plot Type: candlesticks2 (OHLC Filled Candlesticks Plot)">candlesticks2</a>).
522
Called by <a class="xref" href="DrawGraph.html" title="DrawGraph"><span class="refentrytitle">DrawGraph</span></a> when the plot type is one of those
523
three types.
524
This was added in PHPlot-5.3.0.
525
    </p></dd><dt><span class="term"><a id="DrawPieChart"></a>DrawPieChart()</span></dt><dd><p>
526
Draws a pie chart plot.
527
Called by <a class="xref" href="DrawGraph.html" title="DrawGraph"><span class="refentrytitle">DrawGraph</span></a> with the plot type is
528
<a class="link" href="conc-plottypes.html#plottype-pie" title="3.4.10. Plot Type: pie (Pie Plot)">pie</a>.
529
    </p></dd><dt><span class="term"><a id="DrawPieLabel"></a>DrawPieLabel($label_txt, $xc, $yc, $start_angle, $arc_angle, $r)</span></dt><dd><p>
530
Draws a pie chart label. $label_txt is the already-formatted label text
531
string. ($xc, $yc) is the center of the pie (not the text basepoint).
532
$start_angle is the starting angle in degrees for the segment being
533
labeled, which extends for $arc_angle degrees. $r is an array of static
534
values (constant for each pie chart): ellipse parameters and a flag to
535
indicate the text alignment should be reversed.
536
Called by <a class="xref" href="dev-internal.html#DrawPieChart">DrawPieChart</a>.
537
This was added in PHPlot-5.6.0.
538
    </p></dd><dt><span class="term"><a id="DrawPlotAreaBackground"></a>DrawPlotAreaBackground()</span></dt><dd><p>
539
Draws the plot area background, either an image file set with
540
<a class="xref" href="SetPlotAreaBgImage.html" title="SetPlotAreaBgImage"><span class="refentrytitle">SetPlotAreaBgImage</span></a>,
541
or else a solid fill color selected by <a class="xref" href="SetPlotBgColor.html" title="SetPlotBgColor"><span class="refentrytitle">SetPlotBgColor</span></a>
542
if enabled with <a class="xref" href="SetDrawPlotAreaBackground.html" title="SetDrawPlotAreaBackground"><span class="refentrytitle">SetDrawPlotAreaBackground</span></a>
543
or else nothing.
544
Called by <a class="xref" href="DrawGraph.html" title="DrawGraph"><span class="refentrytitle">DrawGraph</span></a>.
545
    </p></dd><dt><span class="term"><a id="DrawPlotBorder"></a>DrawPlotBorder($draw_axes=TRUE)</span></dt><dd><p>
546
Draws the border around the plot area.
547
This draws zero to four lines around the plot area (depending on
548
<a class="xref" href="SetPlotBorderType.html" title="SetPlotBorderType"><span class="refentrytitle">SetPlotBorderType</span></a>).
549
The $draw_axes argument (added in PHPlot-5.6.0) is true for all plot types
550
except pie charts, and controls the default value if SetPlotBorderType() was
551
not called.
552
Called by <a class="xref" href="DrawGraph.html" title="DrawGraph"><span class="refentrytitle">DrawGraph</span></a>.
553
    </p></dd><dt><span class="term"><a id="DrawShape"></a>DrawShape($x, $y, $record, $color, $allow_none = TRUE)</span></dt><dd><p>
554
Draws a single marker point ('dot' or 'shape') at the given X and Y device
555
(pixel) coordinates, using the given color. The $record parameter selects the
556
marker shape and size using the arrays set up with SetPointSizes() and
557
SetPointShapes(); they are not passed as arguments themselves.
558
Called by <a class="xref" href="dev-internal.html#DrawDot">DrawDot</a> and <a class="xref" href="dev-internal.html#DrawLegend">DrawLegend</a>.
559
This is the function that knows which shapes are available and how to draw
560
them. (<a class="xref" href="SetPointShapes.html" title="SetPointShapes"><span class="refentrytitle">SetPointShapes</span></a> also has a list of valid shapes.)
561
This was added at PHPlot-5.4.0 by moving the shape drawing code out of
562
DrawDot(), leaving behind only the conversion from world to device coordinates.
563
This was necessary because DrawLegend() needs to specify marker positions
564
in pixel coordinates when using point shapes instead of color boxes.
565
    </p><p>
566
If the optional $allow_none is FALSE, then the function will substitute
567
another shape for the special 'none' shape (which suppresses a shape marker
568
for a data set in a linepoints plot). This is used when drawing a legend, to
569
ensure that there is a marker shape for each data set. This argument was
570
added in PHPlot-6.0.0.
571
    </p></dd><dt><span class="term"><a id="DrawSquared"></a>DrawSquared()</span></dt><dd><p>
572
Draws a squared (stepped lines) plot.
573
Called by <a class="xref" href="DrawGraph.html" title="DrawGraph"><span class="refentrytitle">DrawGraph</span></a> when the plot type is
574
<a class="link" href="conc-plottypes.html#plottype-squared" title="3.4.12. Plot Type: squared (Squared Plot)">squared</a>.
575
    </p></dd><dt><span class="term"><a id="DrawSquaredArea"></a>DrawSquaredArea($do_stacked = False)</span></dt><dd><p>
576
Draws a squared area plot, or a stacked squared area plot
577
(if the optional argument is True).
578
Called by <a class="xref" href="DrawGraph.html" title="DrawGraph"><span class="refentrytitle">DrawGraph</span></a> when the plot type is
579
<a class="link" href="conc-plottypes.html#plottype-squaredarea" title="3.4.13. Plot Type: squaredarea (Squared Area Plot)">squaredarea</a> or
580
<a class="link" href="conc-plottypes.html#plottype-stackedsquaredarea" title="3.4.16. Plot Type: stackedsquaredarea (Stacked Squared Area Plot)">stackedsquaredarea</a>.
581
This was added in PHPlot-6.2.0.
582
    </p></dd><dt><span class="term"><a id="DrawStackedBars"></a>DrawStackedBars()</span></dt><dd><p>
583
Draws a stacked bars chart plot.
584
Called by <a class="xref" href="DrawGraph.html" title="DrawGraph"><span class="refentrytitle">DrawGraph</span></a> when the plot type is
585
<a class="link" href="conc-plottypes.html#plottype-stackedbars" title="3.4.15. Plot Type: stackedbars (Stacked Bar Plot)">stackedbars</a>.
586
If the data type indicates a horizontal plot,
587
calls <a class="xref" href="dev-internal.html#DrawHorizStackedBars">DrawHorizStackedBars</a> instead.
588
    </p></dd><dt><span class="term"><a id="DrawText"></a>DrawText($font, $angle, $xpos, $ypos, $color, $text, $halign = 'left', $valign = 'bottom')</span></dt><dd><p>
589
Draws a string of text $text, at position ($xpos, $ypos).
590
The font settings are specified by $font, which is one of the text element
591
names used by <a class="xref" href="SetFont.html" title="SetFont"><span class="refentrytitle">SetFont</span></a> such as <code class="literal">'title'</code>
592
or <code class="literal">'x_label'</code>.  An empty string or NULL can be used to get
593
the <code class="literal">'generic'</code> font.  For backward compatibility,
594
a font array (from the PHPlot object $fonts[] array) can be used too.
595
    </p><p>
596
The text is drawn at angle $angle (built-in fonts can be used at 0
597
and 90 degrees only, TrueType at any angle). $color is a GD color
598
index for the image. Text alignment relative to the (x,y) point is
599
controlled with $halign (<code class="literal">center</code>,
600
<code class="literal">left</code>, or <code class="literal">right</code>)
601
and $valign (<code class="literal">center</code>, <code class="literal">bottom</code>,
602
or <code class="literal">top</code>).
603
    </p><p>
604
Multi-line text strings are supported. This function accounts for the
605
limitations and differences in GD text drawing routines for built-in and
606
TrueType fonts.
607
Called by numerous functions which place text on the plot.
608
    </p><p>
609
Starting with PHPlot-5.0.5, this function just calls
610
<a class="xref" href="dev-internal.html#ProcessText">ProcessText</a> in text drawing mode. DrawText should be used
611
by all internal PHPlot code that needs to draw text, and ProcessText should
612
only be used by DrawText and SizeText.
613
    </p><p>
614
Starting with PHPlot-5.1.0, $font can be NULL or an empty string to
615
use the <span class="emphasis"><em>generic</em></span> font.
616
This was intended to allow callbacks to avoid having to reference the internal
617
class array variable which stores font information.
618
    </p><p>
619
Starting with PHPlot-6.0.0, the preferred form for $font is the name of a
620
PHPlot text element, with use of the $fonts[] member variable deprecated.
621
This further eases use of DrawText by callbacks, which can specify a font
622
other than 'generic' without referencing internal class variables.
623
    </p></dd><dt><span class="term"><a id="DrawThinBarLines"></a>DrawThinBarLines()</span></dt><dd><p>
624
Draws a thin bar lines plot. This is sometimes called an impulse plot.
625
Called by <a class="xref" href="DrawGraph.html" title="DrawGraph"><span class="refentrytitle">DrawGraph</span></a> when the plot type is
626
<a class="link" href="conc-plottypes.html#plottype-thinbarline" title="3.4.17. Plot Type: thinbarline (Thin Bar Line Plot)">thinbarline</a>.
627
This function draws both vertical and horizontal variants of this plot type.
628
    </p></dd><dt><span class="term"><a id="DrawTitle"></a>DrawTitle()</span></dt><dd><p>
629
Draws the main plot title as set with <a class="xref" href="SetTitle.html" title="SetTitle"><span class="refentrytitle">SetTitle</span></a>. This is centered at the
630
very top of the image.
631
Called by <a class="xref" href="DrawGraph.html" title="DrawGraph"><span class="refentrytitle">DrawGraph</span></a>.
632
    </p></dd><dt><span class="term"><a id="DrawXAxis"></a>DrawXAxis()</span></dt><dd><p>
633
Draws the X (horizontal) axis, including the axis line,
634
tick marks and labels,
635
and also draws the vertical grid lines.
636
All of these except the axis line are done in <a class="xref" href="dev-internal.html#DrawXTicks">DrawXTicks</a>.
637
Called by <a class="xref" href="DrawGraph.html" title="DrawGraph"><span class="refentrytitle">DrawGraph</span></a>.
638
    </p></dd><dt><span class="term"><a id="DrawXDataLabel"></a>DrawXDataLabel($xlab, $xpos, $row, $do_lines=FALSE)</span></dt><dd><p>
639
Draws an axis data label for an X value. The labels are above or below the plot
640
area or both, depending on the value set with
641
<a class="xref" href="SetXDataLabelPos.html" title="SetXDataLabelPos"><span class="refentrytitle">SetXDataLabelPos</span></a>.
642
The $row value indicates the row index in the data array for this label; it
643
is used to position the data label line, and for custom label formatting.
644
If $do_lines is true, this calls <a class="xref" href="dev-internal.html#DrawXDataLine">DrawXDataLine</a> to draw a
645
line from the label to the point, if enabled and supported by the plot type.
646
    </p><p>
647
This function is used by vertical plots.
648
It is called by plot drawing routines for all plot types except
649
<code class="literal">pie</code>:
650
<a class="xref" href="dev-internal.html#DrawArea">DrawArea</a>,
651
<a class="xref" href="dev-internal.html#DrawBars">DrawBars</a>,
652
<a class="xref" href="dev-internal.html#DrawDots">DrawDots</a>,
653
<a class="xref" href="dev-internal.html#DrawThinBarLines">DrawThinBarLines</a>,
654
<a class="xref" href="dev-internal.html#DrawLines">DrawLines</a>,
655
<a class="xref" href="dev-internal.html#DrawSquared">DrawSquared</a>, and
656
<a class="xref" href="dev-internal.html#DrawStackedBars">DrawStackedBars</a>.
657
    </p></dd><dt><span class="term"><a id="DrawXDataLine"></a>DrawXDataLine($xpos, $row)</span></dt><dd><p>
658
Draws X data label lines, which are vertical lines from the bottom or top
659
of the plot to the data points. This is enabled with
660
<a class="xref" href="SetDrawXDataLabelLines.html" title="SetDrawXDataLabelLines"><span class="refentrytitle">SetDrawXDataLabelLines</span></a>. The lines are drawn from the
661
position (above, below, or both) of the X axis data labels, which are set with
662
<a class="xref" href="SetXDataLabelPos.html" title="SetXDataLabelPos"><span class="refentrytitle">SetXDataLabelPos</span></a>.
663
Called by <a class="xref" href="dev-internal.html#DrawXDataLabel">DrawXDataLabel</a>.
664
    </p></dd><dt><span class="term"><a id="DrawXErrorBars"></a>DrawXErrorBars($x, $y $error_plus, $error_minus, $color)</span></dt><dd><p>
665
Draws an error bar set for the point at world coordinates ($x, $y).
666
$error_plus and $error_minus are the X error amounts (in world coordinates).
667
Both are non-negative values.
668
Called by <a class="xref" href="dev-internal.html#DrawDots">DrawDots</a> and <a class="xref" href="dev-internal.html#DrawLines">DrawLines</a> when
669
the data type indicates a horizontal error plot.
670
This was added in PHPlot-6.1.0 when horizontal error plots were implemented.
671
    </p></dd><dt><span class="term"><a id="DrawXTick"></a>DrawXTick($x, $x_pixels)</span></dt><dd><p>
672
Draws a single X value tick mark and its label.
673
These can appear on the bottom of the graph, top of the graph, along the
674
X axis (even if it is in the middle somewhere), on both sides, or nowhere,
675
as set with <a class="xref" href="SetXTickPos.html" title="SetXTickPos"><span class="refentrytitle">SetXTickPos</span></a> and
676
<a class="xref" href="SetXTickLabelPos.html" title="SetXTickLabelPos"><span class="refentrytitle">SetXTickLabelPos</span></a>.
677
$x is the X value of the tick, and $x_pixels is its device coordinate value.
678
Called by <a class="xref" href="dev-internal.html#DrawXTicks">DrawXTicks</a>.
679
This was added at PHPlot-5.0.5 by splitting the code out of DrawXTicks,
680
for symmetry with DrawYTicks.
681
Through PHPlot-5.7.0, $x was passed to this function already formatted with
682
<a class="xref" href="dev-internal.html#FormatLabel">FormatLabel</a>. Starting with PHPlot-5.8.0, the actual tick
683
value is passed, so <code class="function">DrawXTick</code> can decide whether or
684
not to format it.
685
    </p></dd><dt><span class="term"><a id="DrawXTicks"></a>DrawXTicks()</span></dt><dd><p>
686
Draws the vertical grid lines, the tick marks, and tick labels.
687
Calls <a class="xref" href="dev-internal.html#CalcTicks">CalcTicks</a> to calculate the tick parameters.
688
Calls <a class="xref" href="dev-internal.html#DrawXTick">DrawXTick</a> to draw each tick mark and its label.
689
Called by <a class="xref" href="dev-internal.html#DrawXAxis">DrawXAxis</a>.
690
    </p></dd><dt><span class="term"><a id="DrawXTitle"></a>DrawXTitle()</span></dt><dd><p>
691
Draws the X axis title. There can be zero, one, or two of them depending on
692
the position parameter specified in <a class="xref" href="SetXTitle.html" title="SetXTitle"><span class="refentrytitle">SetXTitle</span></a>.
693
Calls <a class="xref" href="dev-internal.html#DrawText">DrawText</a> to actually draw the title(s).
694
Called by <a class="xref" href="DrawGraph.html" title="DrawGraph"><span class="refentrytitle">DrawGraph</span></a>.
695
    </p></dd><dt><span class="term"><a id="DrawYAxis"></a>DrawYAxis()</span></dt><dd><p>
696
Draws the Y (vertical) axis, including the axis line,
697
tick marks and labels,
698
and also draws the horizontal grid lines.
699
All of these except the axis line are done in <a class="xref" href="dev-internal.html#DrawYTicks">DrawYTicks</a>.
700
Called by <a class="xref" href="DrawGraph.html" title="DrawGraph"><span class="refentrytitle">DrawGraph</span></a>.
701
    </p></dd><dt><span class="term"><a id="DrawYDataLabel"></a>DrawYDataLabel($ylab, $ypos, $row, $do_lines=FALSE)</span></dt><dd><p>
702
Draws an axis data label for a Y value. The labels are along the Y axis or
703
side of the plot, or both, depending on the value set with
704
<a class="xref" href="SetYDataLabelPos.html" title="SetYDataLabelPos"><span class="refentrytitle">SetYDataLabelPos</span></a>.
705
The $row value indicates the row index in the data array for this label; it
706
is used for custom label formatting.
707
If $do_lines is true, this calls <a class="xref" href="dev-internal.html#DrawYDataLine">DrawYDataLine</a> to draw a
708
line from the label to the point, if enabled and supported by the plot type.
709
This function is used by horizontal plots, and was added in PHPlot-5.1.2.
710
Called by horizontal plot drawing functions such as
711
<a class="xref" href="dev-internal.html#DrawHorizBars">DrawHorizBars</a>.
712
The $do_lines argument was added in PHPlot-6.0.0 when horizontal plots
713
supporting data label lines were first available.
714
    </p></dd><dt><span class="term"><a id="DrawYDataLine"></a>DrawYDataLine($ypos, $row)</span></dt><dd><p>
715
Draws Y data label lines, which are horizontal lines from the left or right
716
side of the plot to the data points. This is enabled with
717
<a class="xref" href="SetDrawYDataLabelLines.html" title="SetDrawYDataLabelLines"><span class="refentrytitle">SetDrawYDataLabelLines</span></a>, and is only valid with horizontal
718
plots which support Y data label lines. The lines are drawn from the
719
position (left, right, or both) of the Y axis data labels, which are set with
720
<a class="xref" href="SetYDataLabelPos.html" title="SetYDataLabelPos"><span class="refentrytitle">SetYDataLabelPos</span></a>.
721
Called by <a class="xref" href="dev-internal.html#DrawYDataLabel">DrawYDataLabel</a>.
722
This was added in PHPlot-6.0.0.
723
    </p></dd><dt><span class="term"><a id="DrawYErrorBar"></a>DrawYErrorBar($x_world, $y_world, $error_height, $color)</span></dt><dd><p>
724
This function was removed in PHPlot-6.1.0 and replaced with
725
<a class="xref" href="dev-internal.html#DrawYErrorBars">DrawYErrorBars</a>.
726
    </p></dd><dt><span class="term"><a id="DrawYErrorBars"></a>DrawYErrorBars($x, $y $error_plus, $error_minus, $color)</span></dt><dd><p>
727
Draws an error bar set for the point at world coordinates ($x, $y).
728
$error_plus and $error_minus are the Y error amounts (in world coordinates).
729
Both are non-negative values.
730
Called by <a class="xref" href="dev-internal.html#DrawDots">DrawDots</a> and <a class="xref" href="dev-internal.html#DrawLines">DrawLines</a> when
731
the data type indicates a vertical error plot.
732
This was added in PHPlot-6.1.0, replacing <a class="xref" href="dev-internal.html#DrawYErrorBar">DrawYErrorBar</a>
733
(which drew only 1 of the error bars for a point).
734
    </p></dd><dt><span class="term"><a id="DrawYTick"></a>DrawYTick($y, $y_pixels)</span></dt><dd><p>
735
Draws a single Y value tick mark and its label.
736
These can appear on the left of the graph, right of the graph, along the
737
Y axis (even if it is in the middle somewhere), on both sides, or nowhere,
738
as set with <a class="xref" href="SetYTickPos.html" title="SetYTickPos"><span class="refentrytitle">SetYTickPos</span></a> and
739
<a class="xref" href="SetYTickLabelPos.html" title="SetYTickLabelPos"><span class="refentrytitle">SetYTickLabelPos</span></a>.
740
$y is the Y value of the tick, and $y_pixels is its device coordinate value.
741
Called by <a class="xref" href="dev-internal.html#DrawYTicks">DrawYTicks</a>.
742
Through PHPlot-5.7.0, $y was passed to this function already formatted with
743
<a class="xref" href="dev-internal.html#FormatLabel">FormatLabel</a>. Starting with PHPlot-5.8.0, the actual tick
744
value is passed, so <code class="function">DrawYTick</code> can decide whether or
745
not to format it.
746
    </p></dd><dt><span class="term"><a id="DrawYTicks"></a>DrawYTicks()</span></dt><dd><p>
747
Draws the horizontal grid lines, the tick marks, and tick labels.
748
Calls <a class="xref" href="dev-internal.html#DrawYTick">DrawYTick</a> to draw each tick mark and its label.
749
Called by <a class="xref" href="dev-internal.html#DrawYAxis">DrawYAxis</a>.
750
    </p></dd><dt><span class="term"><a id="DrawYTitle"></a>DrawYTitle()</span></dt><dd><p>
751
Draws the Y axis title. There can be zero, one, or two of them depending on
752
the position parameter specified in <a class="xref" href="SetYTitle.html" title="SetYTitle"><span class="refentrytitle">SetYTitle</span></a>.
753
Calls <a class="xref" href="dev-internal.html#DrawText">DrawText</a> to actually draw the title(s).
754
Called by <a class="xref" href="DrawGraph.html" title="DrawGraph"><span class="refentrytitle">DrawGraph</span></a>.
755
    </p></dd><dt><span class="term"><a id="FindDataLimits"></a>FindDataLimits()</span></dt><dd><p>
756
Finds the limits of the data. Using the data_type and the data array, it
757
goes through the points and determines the minimum and maximum X and Y values.
758
It stores the min and max Y values for each row (plot line) in the
759
class arrays data_min and data_max.
760
(Before PHPlot-5.0.4, these were stored back into the data array
761
with special index values MINY (-1) and MAXY (-2).)
762
It also stores the overall min and max X and Y values as min_x, max_x,
763
min_y, and max_y.
764
It also stores the length of the longest data label in max_t.
765
Starting with PHPlot-5.0.5, this is only called once by
766
<a class="xref" href="DrawGraph.html" title="DrawGraph"><span class="refentrytitle">DrawGraph</span></a>. (In PHPlot-5.0.4 and earlier, this was called
767
from various places, with a flag data_limits_done to indicate it was called.)
768
    </p></dd><dt><span class="term"><a id="FormatLabel"></a>FormatLabel($which_pos, $which_lab, ...)</span></dt><dd><p>
769
Formats a value for use as a tick, data, or pie chart label.
770
This implements the format type selected with
771
<a class="xref" href="SetXLabelType.html" title="SetXLabelType"><span class="refentrytitle">SetXLabelType</span></a>, <a class="xref" href="SetYLabelType.html" title="SetYLabelType"><span class="refentrytitle">SetYLabelType</span></a>,
772
<a class="xref" href="SetXDataLabelType.html" title="SetXDataLabelType"><span class="refentrytitle">SetXDataLabelType</span></a>, <a class="xref" href="SetYDataLabelType.html" title="SetYDataLabelType"><span class="refentrytitle">SetYDataLabelType</span></a>,
773
and <a class="xref" href="SetPieLabelType.html" title="SetPieLabelType"><span class="refentrytitle">SetPieLabelType</span></a>.
774
If no formatting is in effect for that label type ($which_pos), it returns the
775
label string $which_lab as-is. Otherwise, it formats it as directed. This
776
can be a floating point number (formatted with <a class="xref" href="dev-internal.html#number_format">number_format</a>),
777
a date/time value, or it can be formatted with <code class="function">sprintf</code>
778
or a user-defined function (type 'custom').
779
Any additional arguments after the first 2 are passed through to a custom label
780
formatting function. This is used to make the data row and column available
781
to the user-defined function (if applicable for the label type).
782
    </p><p>
783
Called by several functions that need to format label values.
784
Separation of data and tick label formatting was available starting with
785
PHPlot-5.1.0. Use with pie chart labels was added in PHPlot-5.6.0.
786
Support for additional arguments for custom functions  was added
787
in PHPlot-5.8.0.
788
    </p></dd><dt><span class="term"><a id="FormatPieLabel"></a>FormatPieLabel($index, $pie_label_source, $arc_angle, $slice_weight)</span></dt><dd><p>
789
Formats a pie chart label. This first gets the initial value, based on
790
the $source argument to <a class="xref" href="SetPieLabelType.html" title="SetPieLabelType"><span class="refentrytitle">SetPieLabelType</span></a>, which is passed
791
in as $pie_label_source. It may use $index, $arc_angle, or $slice_weight,
792
or a combination of those. Then it formats that value using
793
<a class="xref" href="dev-internal.html#FormatLabel">FormatLabel</a> and returns the result.
794
Called by <a class="xref" href="dev-internal.html#DrawPieChart">DrawPieChart</a>.
795
This was added in PHPlot-5.6.0.
796
    </p></dd><dt><span class="term"><a id="GetBarColors"></a>GetBarColors($row, $idx, &amp;$vars, &amp;$data_color, &amp;$shade_color, &amp;$border_color)</span></dt><dd><p>
797
Gets the color indexes to be used for a bar plot.
798
This is used by bar and stackedbar plot drawing functions, and
799
accounts for a custom data color callback if defined.
800
$row and $idx are the indexes for the current bar or bar segment.
801
$vars is an array argument that maintains information across calls - the
802
caller allocates an empty array, and this function updates it.
803
The color index for bar filling is returned in $data_color.
804
$shade_color is the color index to use for shading (if shading is on).
805
$border_color is the color index to use for the bar border (if on).
806
This was added in PHPlot-5.2.0, moving common code into a function.
807
In PHPlot-6.0.0, a single $alt_color argument was split into separate
808
$shade_color and $border_color arguments.
809
    </p></dd><dt><span class="term"><a id="GetColorIndex"></a>GetColorIndex(&amp;$color, $default_color_index=0)</span></dt><dd><p>
810
Allocate a GD color index for a color given as a 4 component array (R,G,B,A)
811
$color.  Returns a color index to be used in GD drawing functions.
812
The color returned is the exact color requested if it already exists in the
813
image, or if can be allocated.
814
For palette images, if the color map is full, no new colors can be allocated,
815
and this function will return an index to the closest existing color.
816
For truecolor images, this function always returns an index for the exact
817
requested color.
818
If $color is empty or unset, returns $default_color_index instead, without
819
allocating a new color.
820
This was added in PHPlot-5.2.0, replacing the second half of
821
<a class="xref" href="dev-internal.html#SetIndexColor">SetIndexColor</a>.
822
The $default_color_index argument was added in PHPlot-5.7.0, and the $color
823
argument was changed to a reference (so an unset variable can be passed
824
without an error).
825
    </p></dd><dt><span class="term"><a id="GetColorIndexArray"></a>GetColorIndexArray($color_array, $max_colors)</span></dt><dd><p>
826
Allocates GD color indexes for each color in the array $color_array, which are
827
given as 4 component arrays (R,G,B,A). Up to $max_colors colors will be
828
allocated. (This is used to limit the number of allocated data colors to the
829
number of data sets in the plot, for example.)
830
<a class="xref" href="dev-internal.html#GetColorIndex">GetColorIndex</a> is used to allocate each color.
831
Returns an array of GD color indexes to be used in GD drawing functions.
832
This was added in PHPlot-5.3.1.
833
    </p></dd><dt><span class="term"><a id="GetDarkColorIndex"></a>GetDarkColorIndex($color)</span></dt><dd><p>
834
Allocate a GD color index for a darker shade of a color given as a 4 component
835
array (R,G,B,A).
836
Returns a color index to be used in GD drawing functions.
837
The method used is to subtract 48 from each red, green, and blue component
838
(without letting any go negative).
839
The alpha component is not adjusted.
840
The color returned is the exact color requested if it already exists in the
841
image, or if can be allocated, else the closest color available.
842
This is used for shadow colors (for example, in bar charts and pie charts).
843
This was added in PHPlot-5.2.0, replacing the second half of
844
<a class="xref" href="dev-internal.html#SetIndexDarkColor">SetIndexDarkColor</a>.
845
    </p></dd><dt><span class="term"><a id="GetDarkColorIndexArray"></a>GetDarkColorIndexArray($color_array, $max_colors)</span></dt><dd><p>
846
Allocates GD color indexes for a darker shade of each color in the array
847
$color_array, which are given as 4 component arrays (R,G,B,A). Up to
848
$max_colors colors will be allocated. (This is used to limit the number of
849
allocated dark-shade data colors to the number of data sets in the plot,
850
for example.)
851
<a class="xref" href="dev-internal.html#GetDarkColorIndex">GetDarkColorIndex</a> is used to allocate each color.
852
Returns an array of GD color indexes to be used in GD drawing functions.
853
This was added in PHPlot-5.3.1.
854
    </p></dd><dt><span class="term"><a id="GetDataColor"></a>GetDataColor($row, $idx, &amp;$vars, &amp;$data_color, $extra=0)</span></dt><dd><p>
855
Gets the color index to be used for a data element (a point or line
856
segment, for example).
857
This is used by multiple plot drawing functions to get the data color,
858
accounting for a custom data color callback if defined.
859
$row and $idx are the indexes for the data point. $vars is an array argument
860
that maintains information across calls - the caller allocates an empty
861
array, and this function updates it.
862
The color index to use is returned in $data_color.
863
$extra contains extra information for a data color callback.
864
This was added in PHPlot-5.2.0, moving common code into a function.
865
    </p></dd><dt><span class="term"><a id="GetDataErrorColors"></a>GetDataErrorColors($row, $idx, &amp;$vars, &amp;$data_color, &amp;$error_color, $extra=0)</span></dt><dd><p>
866
This is an extended version of <a class="xref" href="dev-internal.html#GetDataColor">GetDataColor</a> which is used
867
for error bar plots. It returns two color index values: $data_color for the
868
data element, and $error_color for the error bar.
869
This is used by error plot drawing functions, and accounts for a custom
870
data color callback if defined.
871
$row and $idx are the indexes for the data point. $vars is an array argument
872
that maintains information across calls - the caller allocates an empty
873
array, and this function updates it.
874
$extra contains extra information for a data color callback.
875
This was added in PHPlot-5.2.0, moving common code into a function.
876
    </p></dd><dt><span class="term"><a id="GetDefaultTTFont"></a>GetDefaultTTFont()</span></dt><dd><p>
877
Returns the default TrueType font name. If no default font has been set
878
using <a class="xref" href="SetDefaultTTFont.html" title="SetDefaultTTFont"><span class="refentrytitle">SetDefaultTTFont</span></a>, the first time this is called it
879
will go through a list of likely sans-serif fonts, trying to find one
880
that works.  The first one that works, or the last one if none works, will
881
be set as the default font.
882
This was added in PHPlot-5.1.3, replacing the static initialization of
883
default font.
884
    </p></dd><dt><span class="term"><a id="GetGridSetting"></a>GetGridSetting($xy)</span></dt><dd><p>
885
Returns a flag indicating whether to draw the grid along the axis
886
indicated by $xy ('x' or 'y'). This implements the grid default which
887
differs for horizontal and vertical plots.
888
This was added in PHPlot-6.0.0, replacing CalcGridSettings().
889
    </p></dd><dt><span class="term"><a id="GetImage"></a>GetImage($image_filename, &amp;$width, &amp;$height)</span></dt><dd><p>
890
Reads an image file from $image_filename, stores the width and height
891
(in pixels) in the $width and $height reference arguments, and returns
892
a PHP GD image resource of the image.
893
This is used by <a class="xref" href="dev-internal.html#SetInputFile">SetInputFile</a> and <a class="xref" href="dev-internal.html#tile_img">tile_img</a>.
894
Errors go to <a class="xref" href="dev-internal.html#PrintError">PrintError</a>; there is no way for the script
895
to recover. Possible errors include an image file type which is unsupported
896
by PHP GD, or a corrupt image file.
897
Note: This was added at PHPlot-5.0.4, by moving common code from the
898
two calling functions.
899
    </p></dd><dt><span class="term"><a id="GetImageBorderWidth"></a>GetImageBorderWidth()</span></dt><dd><p>
900
This returns the image border width, as set with
901
<a class="xref" href="SetImageBorderWidth.html" title="SetImageBorderWidth"><span class="refentrytitle">SetImageBorderWidth</span></a> or as defaulted.
902
It is used by <a class="xref" href="dev-internal.html#CalcMargins">CalcMargins</a> to account for image border width,
903
and by <a class="xref" href="dev-internal.html#DrawImageBorder">DrawImageBorder</a> when drawing the image border.
904
This was added in PHPlot-5.1.2.
905
    </p></dd><dt><span class="term"><a id="GetImageType"></a>GetImageType(&amp;$mime_type, &amp;$output_f)</span></dt><dd><p>
906
Given the current file type (e.g. 'png'), this sets the MIME type for the
907
image (e.g. 'image/png') and the name of the GD output function (e.g.
908
'imagepng') corresponding to that type. The results are stored in the
909
arguments, and TRUE is returned unless an error occurs.
910
It is used by <a class="xref" href="PrintImage.html" title="PrintImage"><span class="refentrytitle">PrintImage</span></a> and <a class="xref" href="EncodeImage.html" title="EncodeImage"><span class="refentrytitle">EncodeImage</span></a>.
911
This was added in PHPlot-5.5.0, from code moved out of PrintImage.
912
    </p></dd><dt><span class="term"><a id="GetLegendPosition"></a>GetLegendPosition($width, $height)</span></dt><dd><p>
913
This calculates and returns the device coordinates (as a 2 element array X,Y)
914
of the upper left corner of the legend box. $width and $height are the size of
915
the legend box.  It accounts for the positioning mode, reference point,
916
base point, and pixel offset as set with <a class="xref" href="SetLegendPosition.html" title="SetLegendPosition"><span class="refentrytitle">SetLegendPosition</span></a>.
917
Called by <a class="xref" href="dev-internal.html#DrawLegend">DrawLegend</a>.
918
This was added in PHPlot-5.4.0.
919
    </p></dd><dt><span class="term"><a id="GetLegendSizeParams"></a>GetLegendSizeParams()</span></dt><dd><p>
920
This calculates a number of parameters that determine how to draw the
921
legend, and returns an array containing those variables and their values.
922
Called by <a class="xref" href="GetLegendSize.html" title="GetLegendSize"><span class="refentrytitle">GetLegendSize</span></a> (which only uses the 'width' and
923
'height' elements), and by <a class="xref" href="dev-internal.html#DrawLegend">DrawLegend</a>.
924
This was added in PHPlot-5.4.0.
925
    </p></dd><dt><span class="term"><a id="GetLineSpacing"></a>GetLineSpacing($font)</span></dt><dd><p>
926
Given a font array variable, returns the proper spacing in pixels between lines
927
of text using that font. This works for both GD and TrueType fonts. See also
928
<a class="xref" href="SetLineSpacing.html" title="SetLineSpacing"><span class="refentrytitle">SetLineSpacing</span></a>.
929
Used by <a class="xref" href="dev-internal.html#ProcessTextGD">ProcessTextGD</a>, <a class="xref" href="dev-internal.html#ProcessTextTTF">ProcessTextTTF</a>,
930
and <a class="xref" href="dev-internal.html#DrawLegend">DrawLegend</a>.
931
Note: This was added at PHPlot-5.0.6, with support for mixing TTF and GD
932
fonts.
933
    </p></dd><dt><span class="term"><a id="GetRangeEndAdjust"></a>GetRangeEndAdjust($which, &amp;$adjust)</span></dt><dd><p>
934
Applies a default to $adjust, the plot range end adjustment factor. $which is
935
'x' or 'y'. If $adjust is already set, the function does nothing.
936
Otherwise, it uses the current plot type to apply a default setting to $adjust.
937
See the notes on the <code class="literal">adjust_type</code> entry in
938
<a class="xref" href="dev-var-notes.html#var-plots" title="10.2.5. plots[]">Section 10.2.5, &#8220;plots[]&#8221;</a> for more on the per-plot-type adjustment mode.
939
This is used by <a class="xref" href="dev-internal.html#CalcPlotRange">CalcPlotRange</a>.
940
It was added at PHPlot-6.0.0.
941
    </p></dd><dt><span class="term"><a id="GetTextAlignment"></a>GetTextAlignment($sin_t, $cos_t, &amp;$h_align, &amp;$v_align, $reverse = FALSE)</span></dt><dd><p>
942
Selects the best alignment for text which is at a specific angle ($sin_t,
943
$cos_t) from a point. The result is returned in $h_align and $v_align,
944
suitable for use with <a class="xref" href="dev-internal.html#DrawText">DrawText</a>.
945
The alignment is chosen from 8 possible values (left/center, center/bottom,
946
etc.) to keep the closest edge or corner of the text box at a fixed
947
distance from the reference point (typically the center of a pie chart, or
948
a plotted point), regardless of the text string size.
949
For example, text at 0 degrees is left/center aligned, and text at 90 degrees
950
is center/bottom aligned.
951
If $reverse is true, the alignment is reversed; this is used for text inside
952
an ellipse but close to the circumference.
953
Used by <a class="xref" href="dev-internal.html#CheckDataValueLabels">CheckDataValueLabels</a>
954
and <a class="xref" href="dev-internal.html#DrawPieLabel">DrawPieLabel</a>.
955
Note: This was added at PHPlot-5.6.0 by moving code out of
956
<a class="xref" href="dev-internal.html#CheckDataValueLabels">CheckDataValueLabels</a>.
957
    </p></dd><dt><span class="term"><a id="initialize"></a>initialize($imagecreate_function, $width, $height, $output_file, $input_file)</span></dt><dd><p>
958
Initialize a newly created object. This is called from the two class
959
constructors, <a class="xref" href="PHPlot.html" title="PHPlot"><span class="refentrytitle">PHPlot</span></a> and <a class="xref" href="PHPlot-truecolor.html" title="PHPlot_truecolor"><span class="refentrytitle">PHPlot_truecolor</span></a>.
960
$imagecreate_function is the name of the GD function used to create an image
961
(<code class="function">imagecreate</code> or <code class="function">imagecreatetruecolor</code>).
962
The other arguments are the same as in the class constructors, except the
963
defaults are already applied.
964
This was added in PHPlot-5.6.0 by moving duplicated code from the two
965
constructors into a shared function.
966
    </p></dd><dt><span class="term"><a id="NeedDataDarkColors"></a>NeedDataDarkColors()</span></dt><dd><p>
967
Allocates darker data colors, which are used for shading.
968
This is called by graph drawing functions such as <a class="xref" href="dev-internal.html#DrawPieChart">DrawPieChart</a>
969
if they need to use these colors for shading.
970
This was added in PHPlot-5.2.0.
971
    </p></dd><dt><span class="term"><a id="NeedErrorBarColors"></a>NeedErrorBarColors()</span></dt><dd><p>
972
Allocates colors used for error bars.
973
This is called by any graph drawing functions that is going to draw error bars.
974
This was added in PHPlot-5.2.0.
975
    </p></dd><dt><span class="term"><a id="number_format"></a>number_format($number, $decimals=0)</span></dt><dd><p>
976
Formats a floating point number, like PHP's number_format(), inserting
977
a decimal separator and thousands groups separators. Unlike the PHP
978
function, this uses variables in the PHPlot class to select the separators.
979
The separators can be set with <a class="xref" href="SetNumberFormat.html" title="SetNumberFormat"><span class="refentrytitle">SetNumberFormat</span></a>, or by
980
default PHPlot will attempt to get locale-specific values.
981
For example, 1234+(56/100) will be returned as "1,234.56" if the locale is
982
"en_US", and as "1.234,56" if the locale is "de_DE".
983
As a fall-back, if locale information is not available, '.' is used for
984
decimal point, and ',' for thousands separator. This fall-back is equivalent
985
to the behavior in PHPlot 5.0rc3 and earlier.
986
This is used by <a class="xref" href="dev-internal.html#FormatLabel">FormatLabel</a> when the formatting type is
987
<code class="literal">data</code>, and also for the pie chart labels in
988
<a class="xref" href="dev-internal.html#DrawPieChart">DrawPieChart</a>.
989
    </p></dd><dt><span class="term"><a id="pad_array"></a>pad_array(&amp;$arr, $size)</span></dt><dd><p>
990
Pads an array $arr with copies of itself until it reaches the given size.
991
If $arr is a scalar, it will first be converted to an array with one
992
element. Then, if $arr has fewer than $size elements, elements of $arr
993
starting from the first will be appended until it reaches $size elements.
994
This only works on zero-based sequential integer indexed arrays.
995
Called by <a class="xref" href="dev-internal.html#PadArrays">PadArrays</a>, <a class="xref" href="SetPointShapes.html" title="SetPointShapes"><span class="refentrytitle">SetPointShapes</span></a>,
996
and <a class="xref" href="SetPointSizes.html" title="SetPointSizes"><span class="refentrytitle">SetPointSizes</span></a>.
997
This replaced <a class="xref" href="dev-internal.html#array_pad_array">array_pad_array</a> at PHPlot-5.0.4,
998
however that had an unused 3rd argument, and worked on general indexed arrays.
999
    </p></dd><dt><span class="term"><a id="PadArrays"></a>PadArrays()</span></dt><dd><p>
1000
Pads the style arrays (line_widths, line_styles, data_colors, etc.) so they
1001
are all large enough to contain an entry for each data set or plot line.
1002
This uses <a class="xref" href="dev-internal.html#pad_array">pad_array</a>.
1003
Called by <a class="xref" href="DrawGraph.html" title="DrawGraph"><span class="refentrytitle">DrawGraph</span></a> before drawing anything.
1004
    </p></dd><dt><span class="term"><a id="PrintError"></a>PrintError($error_message)</span></dt><dd><p>
1005
Handles a fatal error within PHPlot. Starting with PHPlot-5.0.5 this and
1006
<a class="xref" href="dev-internal.html#DrawError">DrawError</a> are identical. PrintError attempts to draw the
1007
error message $error_message into the image, and then output the image.
1008
This method is used because PHPlot is normally expected to output an image,
1009
and text output would not be displayed properly. (If no image resource was
1010
available, and the <a class="xref" href="SetIsInline.html" title="SetIsInline"><span class="refentrytitle">SetIsInline</span></a> flag is not on, PHPlot
1011
will send a 500 Internal Server Error header.) PrintError uses
1012
<a class="xref" href="DrawMessage.html" title="DrawMessage"><span class="refentrytitle">DrawMessage</span></a> to actually draw the message onto the image.
1013
After this, PrintError uses the PHP trigger_error() function to signal a user
1014
error. This is normally fatal to the script, unless caught. This will also
1015
result in the error message written to the error output stream, which
1016
typically ends up in a web server error log.
1017
    </p><p>
1018
(Through PHPlot-5.0.4, PrintError wrote an error message to standard output
1019
and exited.)
1020
    </p></dd><dt><span class="term"><a id="ProcessText"></a>ProcessText($draw_it, $font_id, $angle, $x, $y, $color, $text, $halign, $valign)</span></dt><dd><p>
1021
This function acts as a bridge, or switch, between the two functions
1022
<a class="xref" href="dev-internal.html#SizeText">SizeText</a> and <a class="xref" href="dev-internal.html#DrawText">DrawText</a>, which handle
1023
both GD and TTF text,
1024
and the functions which specifically handle GD text or TTF text.
1025
The arguments to this function are the same as
1026
<a class="xref" href="dev-internal.html#DrawText">DrawText</a> except for an additional first argument
1027
$draw_it. If $draw_it is true, text is drawn. This is used by DrawText. If
1028
$draw_it is false, only the bounding box size of the text is calculated and
1029
returned. This is used by SizeText. In text sizing mode, the x, y, color,
1030
halign, and valign arguments are ignored, as they are not needed when
1031
calculating the text bounding box size.
1032
This function is only called by
1033
<a class="xref" href="dev-internal.html#SizeText">SizeText</a> and <a class="xref" href="dev-internal.html#DrawText">DrawText</a>, and calls either
1034
<a class="xref" href="dev-internal.html#ProcessTextTTF">ProcessTextTTF</a> or <a class="xref" href="dev-internal.html#ProcessTextGD">ProcessTextGD</a>.
1035
    </p><p>
1036
<code class="function">ProcessText</code> examines the $font_id argument and handles
1037
the variations described under <a class="xref" href="dev-internal.html#DrawText">DrawText</a>. If $font_id is
1038
an array, it is assumed to be an element of the member array $fonts[], and
1039
is passed as-is to the lower level functions.
1040
If it is a string that exists as an index to $fonts[], that font array is
1041
used. In all other cases, the <code class="literal">generic</code> font is used.
1042
    </p></dd><dt><span class="term"><a id="ProcessTextGD"></a>ProcessTextGD($draw_it, $font, $angle, $x, $y, $color, $text, $h_factor, $v_factor)</span></dt><dd><p>
1043
Draws GD fixed-font text, or calculates the size of GD fixed-font text.
1044
This is only called by <a class="xref" href="dev-internal.html#ProcessText">ProcessText</a> after it determines
1045
that GD text is in use.
1046
If $draw_it is true, text is drawn;
1047
if $draw_it is false, only the bounding box size of the text is calculated and
1048
returned as a two-element array ($width, $height).
1049
Here $width is measured along the X axis, and $height along Y, regardless
1050
of the text angle. These are the size of an orthogonal bounding box that
1051
contains the text block.
1052
The $font argument is a PHPlot font array, which must reference a GD font.
1053
The $angle is 0 or 90 degrees, as GD text only supports those values.
1054
$x, $y are the reference point of the text $text, which is drawn in color
1055
$color.
1056
The text string can contain multiple lines, with a newline character between
1057
lines.
1058
The $h_factor and $v_factor arguments are translated from the
1059
alignment arguments supplied to DrawText or SizeText: 0, 0.5, or 1.0
1060
If $draw_it is false, for text sizing mode, the x, y, color,
1061
h_factor and v_factor arguments are ignored.
1062
    </p><p>
1063
Note: This was added at PHPlot-5.0.5. It was changed at PHPlot-5.0.6 to
1064
take a single font array argument, rather than 3 separate arguments for
1065
font number, width, and height.
1066
    </p></dd><dt><span class="term"><a id="ProcessTextTTF"></a>ProcessTextTTF($draw_it, $font, $angle, $x, $y, $color, $text, $h_factor, $v_factor)</span></dt><dd><p>
1067
Draws TTF text, or calculates the size of TTF text.
1068
This is only called by <a class="xref" href="dev-internal.html#ProcessText">ProcessText</a> after it determines
1069
that TTF text is in use.
1070
If $draw_it is true, text is drawn;
1071
if $draw_it is false, only the bounding box size of the text is calculated and
1072
returned as a two-element array ($width, $height).
1073
Here $width is measured along the X axis, and $height along Y, regardless
1074
of the text angle. These are the size of an orthogonal bounding box that
1075
contains the text block.
1076
The $font argument is a PHPlot font array, which must reference a TTF font.
1077
The text is drawn at $angle degrees; unlike GD text TTF text can be drawn
1078
at any angle.
1079
$x, $y are the reference point of the text $text, which is drawn in color
1080
$color.
1081
The text string can contain multiple lines, with a newline character between
1082
lines.
1083
The $h_factor and $v_factor arguments are translated from the
1084
alignment arguments supplied to DrawText or SizeText: 0, 0.5, or 1.0
1085
If $draw_it is false, for text sizing mode, the x, y, color,
1086
h_factor and v_factor arguments are ignored.
1087
    </p><p>
1088
Note that the interpretation of the alignment for text at arbitrary angles
1089
may not be what you expect. Rotation of text happens before alignment, and
1090
alignment and positioning use the orthogonal bounding box of the text.
1091
    </p><p>
1092
Note: This was added at PHPlot-5.0.5. It was changed in PHPlot-5.0.6 to
1093
take a single font array argument, rather than 2 separate arguments for
1094
font filename and size.
1095
    </p></dd><dt><span class="term"><a id="SetBgColorIndexes"></a>SetBgColorIndexes()</span></dt><dd><p>
1096
Allocates the colors for the image background and image border.
1097
Called by <a class="xref" href="dev-internal.html#SetColorIndexes">SetColorIndexes</a> before drawing anything, and
1098
by <a class="xref" href="DrawMessage.html" title="DrawMessage"><span class="refentrytitle">DrawMessage</span></a> if needed.
1099
This was added in PHPlot-5.7.0 by moving code from SetColorIndexes, so that
1100
DrawMessage can set up only the color indexes it needs.
1101
    </p></dd><dt><span class="term"><a id="SetColorIndexes"></a>SetColorIndexes()</span></dt><dd><p>
1102
Allocates all the colors needed for a plot.
1103
Called by <a class="xref" href="DrawGraph.html" title="DrawGraph"><span class="refentrytitle">DrawGraph</span></a> before drawing anything.
1104
Calls <a class="xref" href="dev-internal.html#SetBgColorIndexes">SetBgColorIndexes</a> (starting at PHPlot-5.7.0) to set
1105
the background and border color indexes.
1106
This was added in PHPlot-5.2.0.
1107
    </p></dd><dt><span class="term"><a id="SetDashedStyle"></a>SetDashedStyle($which_ndxcol, $use_style = TRUE)</span></dt><dd><p>
1108
Sets the GD line style to select a dashed line, if line styles are enabled,
1109
in preparation for drawing a dashed line. $which_ndxcol is the color index
1110
to use for the line, and $use_style is a flag indicating if a styled line
1111
is to be drawn. Returns a GD color index to use for drawing. If
1112
$use_styles is false, indicating solid lines, the return value is
1113
$which_ndxcol. If $use_styles is true or omitted, the return value is a
1114
GD constant used to indicate drawing a styled line, and $which_ndxcol is
1115
used to set up the line style. The return value is then used by the caller
1116
as the color argument in drawing functions such as
1117
<code class="function">imageline</code>.
1118
    </p><p>
1119
To understand how this function works, see the documentation for the PHP GD
1120
function <code class="function">ImageSetStyle()</code> and also refer to <a class="xref" href="SetDefaultDashedStyle.html" title="SetDefaultDashedStyle"><span class="refentrytitle">SetDefaultDashedStyle</span></a>. GD expects a line style to be specified
1121
as an array of pixel values, which is awkward to deal with.  PHPlot uses a
1122
shorthand notation with integer values indicating pairs of the number of
1123
color pixels ("on" pixels), then transparent pixels ("off" pixels).
1124
<code class="function">SetDefaultDashedStyle()</code> creates a template string with
1125
a marker for each "on" pixel, and the special GD color code for transparent
1126
pixels for each "off" pixel.  This template is saved in the class variable
1127
<code class="varname">default_dashed_style</code>.  The actual color to use for the
1128
"on" pixels is filled in by <code class="function">SetDashedStyle()</code> before
1129
the dashed style is used.  The result is an array of pixel values for
1130
<code class="function">ImageSetStyle()</code>.
1131
    </p><p>
1132
(In PHPlot-6.1.0 and earlier, <code class="function">SetDefaultDashedStyle()</code>
1133
created a string of PHP code to generate an array of pixel values in the
1134
form used by the GD function <code class="function">ImageSetStyle()</code>, and
1135
saved this as <code class="varname">default_dashed_style</code>.
1136
<code class="function">SetDashedStyle()</code> then evaluated the PHP code, with
1137
the correct color filled in from <code class="varname">$which_ndxcol</code>.)
1138
    </p><p>
1139
Called by all functions that need to draw lines that can have a line style
1140
applied, including <a class="xref" href="dev-internal.html#DrawXTicks">DrawXTicks</a> and <a class="xref" href="dev-internal.html#DrawYTicks">DrawYTicks</a>
1141
(for drawing the grid lines, not the ticks), and <a class="xref" href="dev-internal.html#DrawLines">DrawLines</a>
1142
for drawing line plots.
1143
    </p><p>
1144
The $use_style argument and return value were added in PHPlot-6.0.0.
1145
Before that, <code class="function">SetDashedStyle</code> unconditionally set up the
1146
line style, and returned a boolean value.
1147
    </p></dd><dt><span class="term"><a id="SetDefaultFonts"></a>SetDefaultFonts()</span></dt><dd><p>
1148
Selects all the default font values and sizes. See <a class="xref" href="SetFont.html" title="SetFont"><span class="refentrytitle">SetFont</span></a>
1149
for details of the font element names and default values.  Called by the class
1150
constructor initialization function <a class="xref" href="dev-internal.html#initialize">initialize</a> to initialize
1151
fonts in the plot object, and by <a class="xref" href="SetUseTTF.html" title="SetUseTTF"><span class="refentrytitle">SetUseTTF</span></a> to restore the
1152
defaults when changing from or to TrueType font usage.
1153
    </p></dd><dt><span class="term"><a id="SetDefaultStyles"></a>SetDefaultStyles()</span></dt><dd><p>
1154
Initializes default colors and styles for PHPlot objects. Mostly this calls
1155
the public member functions such as <a class="xref" href="SetDataColors.html" title="SetDataColors"><span class="refentrytitle">SetDataColors</span></a> but
1156
without specifying an array of colors, which causes the member functions
1157
to select default values.
1158
Called by the class constructor initialization function
1159
<a class="xref" href="dev-internal.html#initialize">initialize</a>.
1160
    </p></dd><dt><span class="term"><a id="SetIndexColor"></a>SetIndexColor($which_color, $alpha = 0)</span></dt><dd><p>
1161
This function was removed in PHPlot-5.2.0.
1162
It parsed a color specification, and allocated a GD color index.
1163
The first part is replaced by calling <a class="xref" href="dev-internal.html#SetRGBColor">SetRGBColor</a> directly,
1164
and the second part is implemented with <a class="xref" href="dev-internal.html#GetColorIndex">GetColorIndex</a>
1165
at graph drawing time.
1166
    </p></dd><dt><span class="term"><a id="SetIndexDarkColor"></a>SetIndexDarkColor($which_color, $alpha = 0)</span></dt><dd><p>
1167
This function was removed in PHPlot-5.2.0.
1168
It parsed a color specification, and allocated a GD color index for a
1169
slightly darker shade of the color.
1170
The first part is replaced by calling <a class="xref" href="dev-internal.html#SetRGBColor">SetRGBColor</a> directly,
1171
and the second part is implemented with <a class="xref" href="dev-internal.html#GetDarkColorIndex">GetDarkColorIndex</a>
1172
at graph drawing time.
1173
    </p></dd><dt><span class="term"><a id="SetInputFile"></a>SetInputFile($which_input_file)</span></dt><dd><p>
1174
Sets an image file $which_input_file to be used as the background image for
1175
the graph. Also resets the graph size to the size of the image file.
1176
Called by the class constructor initialization function
1177
<a class="xref" href="dev-internal.html#initialize">initialize</a>.
1178
Note: In earlier releases, this was considered an externally available
1179
function. After a PHPlot object was created with the constructor,
1180
SetInputFile could be used to resize it and set the background image.
1181
Although this still works, it is deprecated. SetInputFile should be
1182
considered an internal-use-only function. Users should set the background
1183
image file using the 4th argument of <a class="xref" href="PHPlot.html" title="PHPlot"><span class="refentrytitle">PHPlot</span></a> or
1184
<a class="xref" href="PHPlot-truecolor.html" title="PHPlot_truecolor"><span class="refentrytitle">PHPlot_truecolor</span></a>  when creating an instance of the object.
1185
    </p></dd><dt><span class="term"><a id="SetLabelType"></a>SetLabelType($mode, $args)</span></dt><dd><p>
1186
Sets the formatting used for tick, data, and pie chart labels.
1187
This implements <a class="xref" href="SetXLabelType.html" title="SetXLabelType"><span class="refentrytitle">SetXLabelType</span></a>,
1188
<a class="xref" href="SetYLabelType.html" title="SetYLabelType"><span class="refentrytitle">SetYLabelType</span></a>, <a class="xref" href="SetXDataLabelType.html" title="SetXDataLabelType"><span class="refentrytitle">SetXDataLabelType</span></a>,
1189
<a class="xref" href="SetYDataLabelType.html" title="SetYDataLabelType"><span class="refentrytitle">SetYDataLabelType</span></a>, and part of
1190
<a class="xref" href="SetPieLabelType.html" title="SetPieLabelType"><span class="refentrytitle">SetPieLabelType</span></a>.
1191
$mode is either 'x', 'xd', 'y', 'yd', or 'p' to select the type of label
1192
(x, y for tick labels; xd, yd for data labels; p for pie chart labels).
1193
$args is an array of arguments, with $args[0] selecting the type of
1194
formatting (for example, <code class="literal">data</code>).
1195
Additional array elements depend on the formatting type.
1196
For more details, see the above-referenced functions.
1197
All arguments to those functions are combined into an array and passed to
1198
<code class="function">SetLabelType</code> as $args.
1199
Separation of data and tick label formatting was available starting with
1200
PHPlot-5.1.0. Support for pie chart label formatting was added in PHPlot-5.6.0.
1201
    </p></dd><dt><span class="term"><a id="SetRGBColor"></a>SetRGBColor($color_asked, $alpha = 0)</span></dt><dd><p>
1202
Converts a general color specification into a standard form as an array of
1203
4 components: red, green, blue, and alpha, and returns the array.  The 3
1204
color components are integers in the range 0-255, and the alpha component
1205
is an integer in the range 0-127 (where 0 means opaque).  The acceptable
1206
color specification forms are documented in <a class="xref" href="conc-colors.html#conc-colors-forms" title="3.5.1. Color Parameter Forms">Section 3.5.1, &#8220;Color Parameter Forms&#8221;</a>
1207
and <a class="xref" href="adv-truecolor.html#adv-truecolor-forms" title="4.3.4. Color Parameter Form Extensions">Section 4.3.4, &#8220;Color Parameter Form Extensions&#8221;</a>,
1208
and include color names, component arrays, and strings of the form #RRGGBB
1209
and #RRGGBBAA.  The alpha argument provides a default value if the color
1210
specification does not include alpha; the default 0 makes the color
1211
opaque.
1212
This is used directly by all functions that accept a color specification.
1213
Use of alpha in the color specification, the default alpha argument, and the
1214
4th component in the returned array were added in PHPlot-5.1.1.
1215
    </p></dd><dt><span class="term"><a id="SetupAreaPlot"></a>SetupAreaPlot($stacked, &amp;$xd, &amp;$yd)</span></dt><dd><p>
1216
Sets up for an area plot (plot types <code class="literal">area</code>,
1217
<code class="literal">stackedarea</code>, <code class="literal">squaredarea</code>,
1218
and <code class="literal">stackedsquaredarea</code>).
1219
$stacked indicates a stacked (cumulative) plot, so the
1220
Y values in the data array are to be accumulated for each X row.
1221
    </p><p>
1222
This function calculates two arrays, $xd[] and $yd[], which are used for
1223
drawing area fills. On return, $xd[] contains the device coordinates for
1224
the X values from the data array (or implied, for text-data data type).
1225
$yd[] is returned as a 2-dimensional array of Y values in device coordinates.
1226
<code class="function">SetupAreaPlot</code> adds an additional column of Y values
1227
representing the X axis, which is the base line for area fills.
1228
For stacked plots, this goes before the first real Y value in the array.
1229
For unstacked plots, it goes after the last real Y value in the array.
1230
    </p><p>
1231
While traversing the data array, this function also draws axis data labels
1232
if they are enabled. (Doing it here avoids having the calling functions
1233
need to access the data array at all.)
1234
    </p><p>
1235
This was added in PHPlot-6.2.0.
1236
    </p></dd><dt><span class="term"><a id="SizeText"></a>SizeText($font, $angle, $text)</span></dt><dd><p>
1237
Calculates the size of a block of text. It works on both GD (fixed-font) and TTF
1238
text.
1239
$font is a text element name, empty, or a PHPlot font array (use of an array
1240
is deprecated); see <a class="xref" href="dev-internal.html#DrawText">DrawText</a> for details.
1241
$angle is the text angle in degrees.
1242
$text is the text string. The text string can contain multiple lines,
1243
with a newline character between lines.
1244
This function just calls <a class="xref" href="dev-internal.html#ProcessText">ProcessText</a> in text sizing mode
1245
to do the work.
1246
It returns a two-element array with the text width and height. These are the
1247
width and height of an orthogonal bounding box (box aligned with the X
1248
and Y axes) which contains the rotated text block.
1249
Called by functions which need to determine text size for laying out
1250
plot elements, such as <a class="xref" href="dev-internal.html#CalcMargins">CalcMargins</a>.
1251
This function replaced <a class="xref" href="dev-internal.html#TTFBBoxSize">TTFBBoxSize</a> at PHPlot-5.0.5.
1252
    </p></dd><dt><span class="term"><a id="tile_img"></a>tile_img($file, $xorig, $yorig, $width, $height, $mode)</span></dt><dd><p>
1253
Tiles an image from a file onto the plot image.
1254
$file is the filename of the image to use as the tile.
1255
($xorig, $yorig) are the origin point for the tiling,
1256
and ($width, $height) are the area to be tiled. These are used to tile just
1257
under the plot area versus the entire image. The $mode can be
1258
<code class="literal">centeredtile</code>, <code class="literal">tile</code>, or
1259
<code class="literal">scale</code>.  Scale mode scales the source image to
1260
fit the target area. Tile and centeredtile modes repeat the source image as
1261
needed to fit into the target area; the difference is that centeredtile
1262
offsets the tile start position by half its size, which works better for
1263
some tiles.
1264
Called by
1265
<a class="xref" href="dev-internal.html#DrawBackground">DrawBackground</a> and <a class="xref" href="dev-internal.html#DrawPlotAreaBackground">DrawPlotAreaBackground</a>
1266
if an image file is selected for the plot area or overall background.
1267
    </p></dd><dt><span class="term"><a id="truncate_array"></a>truncate_array(&amp;$array, $size)</span></dt><dd><p>
1268
This was added in PHPlot-5.2.0 and removed in PHPlot-5.3.1,
1269
when data color processing was changed to not truncate the color arrays.
1270
    </p></dd><dt><span class="term"><a id="TTFBBoxSize"></a>TTFBBoxSize($size, $angle, $font, $string)</span></dt><dd><p>
1271
This function was removed at PHPlot-5.0.5.
1272
It was replaced by <a class="xref" href="dev-internal.html#SizeText">SizeText</a>.
1273
    </p></dd><dt><span class="term"><a id="TuneAutoRange"></a>TuneAutoRange($which, $zero_magnet, $adjust_mode, $adjust_amount)</span></dt><dd><p>
1274
This implements <a class="xref" href="TuneXAutoRange.html" title="TuneXAutoRange"><span class="refentrytitle">TuneXAutoRange</span></a> and
1275
<a class="xref" href="TuneYAutoRange.html" title="TuneYAutoRange"><span class="refentrytitle">TuneYAutoRange</span></a> to store tuning parameters used by the
1276
automatic range calculation. $which is 'x' or 'y', and the other arguments
1277
are as described under those two public functions.
1278
This was added in PHPlot-6.0.0
1279
    </p></dd><dt><span class="term"><a id="TuneAutoTicks"></a>TuneAutoTicks($which, $min_ticks, $tick_mode, $tick_inc_integer)</span></dt><dd><p>
1280
This implements <a class="xref" href="TuneXAutoTicks.html" title="TuneXAutoTicks"><span class="refentrytitle">TuneXAutoTicks</span></a> and
1281
<a class="xref" href="TuneYAutoTicks.html" title="TuneYAutoTicks"><span class="refentrytitle">TuneYAutoTicks</span></a> to store tuning parameters used by the
1282
tick increment calculation. $which is 'x' or 'y', and the other arguments
1283
are as described under those two public functions.
1284
This was added in PHPlot-6.0.0
1285
    </p></dd><dt><span class="term"><a id="xtr"></a>xtr($x_world)</span></dt><dd><p>
1286
Translates an X world coordinate value into a pixel coordinate value.
1287
This uses the scale and translation set up by <a class="xref" href="dev-internal.html#CalcTranslation">CalcTranslation</a>.
1288
See <a class="xref" href="GetDeviceXY.html" title="GetDeviceXY"><span class="refentrytitle">GetDeviceXY</span></a> for a public interface.
1289
    </p></dd><dt><span class="term"><a id="ytr"></a>ytr($y_world)</span></dt><dd><p>
1290
Translates a Y world coordinate value into a pixel coordinate value.
1291
This uses the scale and translation set up by <a class="xref" href="dev-internal.html#CalcTranslation">CalcTranslation</a>.
1292
See <a class="xref" href="GetDeviceXY.html" title="GetDeviceXY"><span class="refentrytitle">GetDeviceXY</span></a> for a public interface.
1293
    </p></dd><dt><span class="term"><a id="__sleep"></a>__sleep()</span></dt><dd><p>
1294
This is a PHP "magic method" that prepares a PHPlot object for serialization.
1295
It stores the PHPlot version string (for checking at wakeup time), and a
1296
flag indicating if it used a truecolor image or not.
1297
See <a class="xref" href="adv-serialize.html" title="4.2. PHPlot Object Serialization">Section 4.2, &#8220;PHPlot Object Serialization&#8221;</a>.
1298
This was added in PHPlot-5.8.0.
1299
    </p></dd><dt><span class="term"><a id="__wakeup"></a>__wakeup()</span></dt><dd><p>
1300
This is a PHP "magic method" that re-creates a PHPlot object after
1301
unserialization.
1302
It checks the stored version string to make sure the object was serialized with
1303
the exact same PHPlot version, and then re-creates the image resource.
1304
See <a class="xref" href="adv-serialize.html" title="4.2. PHPlot Object Serialization">Section 4.2, &#8220;PHPlot Object Serialization&#8221;</a>.
1305
This was added in PHPlot-5.8.0.
1306
    </p></dd></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="dev-legend.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="part3.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="dev-vars.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 8. PHPlot Legend Layout </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 10. PHPlot Class Member Variables</td></tr></table></div></body></html>