Blame | Last modification | View Log | RSS feed
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?><!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>10.2. Member Variable Notes</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="dev-vars.html" title="Chapter 10. PHPlot Class Member Variables" /><link rel="prev" href="dev-vars.html" title="Chapter 10. PHPlot Class Member Variables" /><link rel="next" href="dev-const.html" title="10.3. PHPlot Class Constants" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">10.2. Member Variable Notes</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="dev-vars.html">Prev</a> </td><th width="60%" align="center">Chapter 10.PHPlot Class Member Variables</th><td width="20%" align="right"> <a accesskey="n" href="dev-const.html">Next</a></td></tr></table><hr /></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="dev-var-notes"></a>10.2. Member Variable Notes</h2></div></div></div><div class="abstract"><p class="title"><strong></strong></p><p>This section contains details on some of the PHPlot class member variableslisted in the previous section.Remember that all PHPlot class member variables are meant for internal use only.</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="var-datatypes"></a>10.2.1. datatypes[]</h3></div></div></div><p>The <code class="varname">datatypes[]</code> array contains information about theavailable data types. See <a class="xref" href="conc-datatypes.html" title="3.3. PHPlot Data Types">Section 3.3, “PHPlot Data Types”</a> for moreinformation about data types.It is used by <a class="xref" href="SetDataType.html" title="SetDataType"><span class="refentrytitle">SetDataType</span></a> to validated the supplied datatype, and by <a class="xref" href="dev-internal.html#DecodeDataType">DecodeDataType</a> to set the flags thatdescribe the datatype.</p><p>The goal is to keep the names and details about the data types in thisarray only, and minimize other uses of the actual data type names. However,each plot type drawing function (for example <a class="xref" href="dev-internal.html#DrawLines">DrawLines</a>)also 'knows' about the data types it supports, and specifies the data typenames when calling <a class="xref" href="dev-internal.html#CheckDataType">CheckDataType</a>.</p><p>This array was added in PHPlot-6.1.0.It is a protected static member variable in the PHPlot class, so it must beaccessed as <code class="varname">self::$datatypes</code> from inside the class (or aderived class), and not through an instance of the class.Is not accessible from outside the class or derived classes.</p><p>The array keys are the data types (for example: 'text-data').The values are arrays which contain information about the data type.The second-level array keys correspond to the 'datatype' flag variables,without the 'datatype_' prefix. A key will be present, with the value<code class="literal">TRUE</code>, if the flag should be set for that data type.The key will be absent if the flag should not be set.For example: for data type <code class="literal">text-data</code>, the array containsone value: <code class="literal">'implied' => TRUE</code>. This means that fordata type text-data, the <code class="literal">datatype_implied</code> flag should beTRUE (indicating that this data type has implied independent variablevalues), and all other flags should be FALSE. In addition to<code class="literal">implied</code>, the other possible keys are<code class="literal">pie_single</code>, <code class="literal">error_bars</code>,<code class="literal">swapped_xy</code>, and <code class="literal">yz</code>.</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="var-fonts"></a>10.2.2. fonts[]</h3></div></div></div><p>The <code class="varname">fonts[]</code> array contains information about the fonts touse for text on the plot. The array keys are the element names (such as<code class="literal">title</code> or <code class="literal">legend</code>) as used in<a class="xref" href="SetFont.html" title="SetFont"><span class="refentrytitle">SetFont</span></a>, <a class="xref" href="SetFontGD.html" title="SetFontGD"><span class="refentrytitle">SetFontGD</span></a>, or<a class="xref" href="SetFontTTF.html" title="SetFontTTF"><span class="refentrytitle">SetFontTTF</span></a>. The array values are arrays which containinformation about the font to use for that element. The keys and values ofthe second-level arrays are:</p><div class="informaltable"><table summary="fonts[] array elements" border="1"><colgroup><col class="c1" /><col class="c2" /><col class="c3" /></colgroup><thead><tr><th>Key</th><th>Value for TTF</th><th>Value for GD Font</th></tr></thead><tbody><tr><td>ttf</td><td>True for a TrueType font</td><td>False for a GD font</td></tr><tr><td>font</td><td>Pathname of the font file</td><td>Font number: 1 through 5</td></tr><tr><td>size</td><td>Font point size</td><td>Not used</td></tr><tr><td>height</td><td>Height in pixels of an upper-case "E" in the font</td><td>Font height in pixels</td></tr><tr><td>width</td><td>Width in pixels of an upper-case "E" in the font</td><td>Font width in pixels</td></tr><tr><td>spacing</td><td>Font's built-in inter-line spacing</td><td>Not used</td></tr><tr><td>line_spacing</td><td>User-requested inter-line spacing factor.</td><td>Same as for TTF</td></tr></tbody></table></div><p></p><p>For TrueType fonts, the height and width can vary by character. The fontsarray stores a height and width value for the font, but these are only usedfor sizing non-text plot elements (such as the legend color boxes). WhenPHPlot needs to know the drawn size of a string that will use TTF, it calculatesthe exact size of that specific string when drawn with the designated font.</p><p>GD fonts have fixed character width and height, so the values stored inthe fonts array can be used to calculate text string sizes.</p><p>The <code class="literal">spacing</code> key stores the TrueType font's built-ininter-line spacing. Although TrueType fonts have this informationinternally, PHP cannot access it, so PHPlot calculates it by taking theheight of the string "E\nE" and subtracting twice the height of the letter E.</p><p>The <code class="literal">line_spacing</code> key stores the user-specified line spacingadjustment for a text element, if any, from <a class="xref" href="SetFont.html" title="SetFont"><span class="refentrytitle">SetFont</span></a> orone of the two related functions. It will be NULL if the spacing wasnot set for this element, meaning use the default line spacing.See <a class="xref" href="SetLineSpacing.html" title="SetLineSpacing"><span class="refentrytitle">SetLineSpacing</span></a> for more information on how this is used.</p><p>Here is an example of part of a fonts array, for the title element:</p><pre class="programlisting">$plot->fonts['title'] = array('ttf' => FALSE, // This element uses a GD font'font' => 2, // Use GD font 2'height' => 13, // Provided by GD'width' => 6, // Provided by GD'line_spacing' => NULL, // Use default line spacing)</pre><p></p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="var-label-format"></a>10.2.3. label_format[]</h3></div></div></div><p>The <code class="varname">label_format[]</code> array contains information about howtext labels should be formatted. This array has 5 entries, with keys 'x','y', 'xd', 'yd', and 'p'. The 'x' and 'y' entries are for tick labels, and the'xd' and 'yd' entries are for data labels. (Note that PHPlot defaults datalabel formatting to match tick label formatting, but this is handled in<a class="xref" href="dev-internal.html#FormatLabel">FormatLabel</a>.)The 'p' entry is for pie chart labels, and will only exist for pie charts.(The 'p' entry was added in PHPlot-5.6.0.)</p><p>The value of each entry in <code class="varname">label_format</code> is an arraycontaining formatting information. The arrays are empty by default, meaningthere is no special formatting. If formatting has been enabled, for examplewith <a class="xref" href="SetXLabelType.html" title="SetXLabelType"><span class="refentrytitle">SetXLabelType</span></a>, the arrays can contain the followingkeys and values:</p><div class="informaltable"><table summary="label_format[] array elements" border="1"><colgroup><col class="c1" /><col class="c2" /><col class="c3" /></colgroup><thead><tr><th>Key</th><th>Used with type</th><th>Value</th></tr></thead><tbody><tr><td>type</td><td> </td><td>Formatting type: data, time, printf, or custom.</td></tr><tr><td>precision</td><td>data</td><td>The number of decimal positions to produce.</td></tr><tr><td>prefix</td><td>data</td><td>A prefix string to append to the label (for example, a currencysign).</td></tr><tr><td>suffix</td><td>data</td><td>A suffix string to append to the label (for example, a currencysign or percent sign).This replaces data_units_text (which still works too).</td></tr><tr><td>time_format</td><td>time</td><td>The date/time format string for the PHP strftime()function.</td></tr><tr><td>printf_format</td><td>printf</td><td>The format string(s) for the PHP printf() function.This can be a single string, or an array of one to three strings.</td></tr><tr><td>custom_callback</td><td>custom</td><td>The function (or array with object and method name) to call toformat the label.</td></tr><tr><td>custom_arg</td><td>custom</td><td>An additional argument to pass to the custom_callbackfunction.</td></tr></tbody></table></div><p></p><p>Use of multiple strings for <code class="literal">printf_format</code> was added inPHPlot-6.2.0.</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="var-legendpos"></a>10.2.4. legend_pos[]</h3></div></div></div><p>The <code class="varname">legend_pos[]</code> array contains information aboutpositioning of the legend. This is set by <a class="xref" href="SetLegendPosition.html" title="SetLegendPosition"><span class="refentrytitle">SetLegendPosition</span></a>,and by the functions which use it (<a class="xref" href="SetLegendPixels.html" title="SetLegendPixels"><span class="refentrytitle">SetLegendPixels</span></a> and<a class="xref" href="SetLegendWorld.html" title="SetLegendWorld"><span class="refentrytitle">SetLegendWorld</span></a>).This was added in PHPlot-5.4.0, replacing scalar variables legend_x_pos,legend_y_pos, and legend_xy_world.</p><p>The array keys correspond to the arguments to<a class="xref" href="SetLegendPosition.html" title="SetLegendPosition"><span class="refentrytitle">SetLegendPosition</span></a> and are shown in the following table.</p><div class="informaltable"><table summary="legend_pos[] array elements" border="1"><colgroup><col class="c1" /><col class="c2" /></colgroup><thead><tr><th>Keys</th><th>Value</th></tr></thead><tbody><tr><td>x, y</td><td>Relative coordinates of a point on the legend box</td></tr><tr><td>mode</td><td>One of: image, plot, title, or world</td></tr><tr><td>x_base, y_base</td><td>Relative coordinates of a point on the image, plot, ortitle, or world coordinates</td></tr><tr><td>x_offset, y_offset</td><td>Pixel offset to be applied last</td></tr></tbody></table></div><p></p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="var-plots"></a>10.2.5. plots[]</h3></div></div></div><p>The <code class="varname">plots[]</code> array contains information about known plottypes. It is used by <a class="xref" href="dev-internal.html#FindDataLimits">FindDataLimits</a>,<a class="xref" href="DrawGraph.html" title="DrawGraph"><span class="refentrytitle">DrawGraph</span></a>, and other class functions to prepare for anddraw the main portion of the plot.The goal is to contain the information about each available plot typein a single place - this array. The actual names of the plot types (forexample 'bars' or 'linepoints') appear only in this array. To simplifysomewhat, adding a new plot type to PHPlot involves adding a new element tothe <code class="varname">plots[]</code> array, and adding a new function to PHPlotwhich draws the 'insides' of the plot.</p><p>This array was added in PHPlot-5.3.0.It is a protected static member variable in the PHPlot class, so it must beaccessed as <code class="varname">self::$plots</code> from inside the class (or aderived class), and not through an instance of the class.Is not accessible from outside the class or derived classes.</p><p>The array keys are the plot types (for example: 'bars', 'linepoints').These must not include upper case letters.The values are arrays which contain information about the plot type.The keys and values of the second-level arrays are:</p><div class="informaltable"><table summary="plots[] array elements" border="1"><colgroup><col class="c1" /><col class="c2" /></colgroup><thead><tr><th>Key</th><th>Value</th></tr></thead><tbody><tr><td>draw_method</td><td>Name of the PHPlot class method (function) to call to draw the 'insides' ofthe plot. This is the only required entry.</td></tr><tr><td>draw_arg</td><td>Optional argument array to pass to the draw_method function.</td></tr><tr><td>suppress_axes</td><td>Optional flag indicating that the X axis and Y axis should not be drawn.Default is FALSE.</td></tr><tr><td>abs_vals</td><td>Optional flag indicating that the plot type uses the absolute values of data.Default is FALSE.</td></tr><tr><td>sum_vals</td><td>Optional flag indicating that the plot type sums up the values in each row.Default is FALSE.</td></tr><tr><td>legend_alt_marker</td><td>Optional alternate marker mode for legends: box, shape, or line.</td></tr><tr><td>adjust_type</td><td>Optional control for adjusting the end of an automatically calculated plotrange (see notes below).</td></tr></tbody></table></div><p></p><p>Only the <code class="literal">draw_method</code> entry is required. The named methodis used to draw everything inside the plot area. (That is, everything exceptthe plot titles, axis lines, tick marks and tick labels, grid lines, andlegend.)</p><p>The <code class="literal">draw_arg</code> entry can be used to pass constantarguments to the <code class="literal">draw_method</code> method.If present, this must be an array, and each element of the array is passed tothe drawing method as a separate argument. If this is not specified, thedrawing method is called with no arguments. This is generally used tooverload drawing methods, so they handle multiple similar plot types.</p><p>The <code class="literal">suppress_axes</code> flag indicates that X and Y axis linesshould not be drawn (used with pie charts, for example).If omitted, FALSE is used, meaning the axis lines are drawn.(Before PHPlot-6.0.0 this was called <code class="literal">draw_axes</code>, withdefault TRUE, and FALSE for pie charts.)</p><p>The two special data processing flags <code class="literal">abs_vals</code> and<code class="literal">sum_vals</code> are used by <a class="xref" href="dev-internal.html#FindDataLimits">FindDataLimits</a>to indicate how to compute the minimum and maximum data values.Plot types that ignore sign and take absolute values of the data set<code class="literal">abs_vals</code> to TRUE.Plot types that sum up the data values in each row set<code class="literal">sum_vals</code> to TRUE.The default if omitted for both flags is FALSE, meaning the plot typeuses the values as specified in the data array.If both <code class="literal">abs_vals</code> and <code class="literal">sum_vals</code> are TRUE,this means the plot type sums up the absolute values from the data array.(The stackedarea plot type does this.)</p><p>The optional <code class="literal">legend_alt_marker</code> entry indicates theuse of an alternate maker shape in legends.Use <a class="xref" href="SetLegendUseShapes.html" title="SetLegendUseShapes"><span class="refentrytitle">SetLegendUseShapes</span></a> to select either the primarymode or the alternate mode for legend shapes. The primary mode is a solidfilled color box. The alternate mode varies with the plot type, accordingthe the <code class="literal">legend_alt_marker</code> entry.Use 'box' for rectangular color boxes. This is the default if the<code class="literal">legend_alt_marker</code> key is omitted from the array.Effectively, this means there is no alternate markermode for these plot types, because color boxes are the primary mode.Use 'shape' for point shape markers, which applies to points plots and similartypes which use point shapes.Use 'line' for short line segments, which applies to line plots and similartypes.</p><p>The optional <code class="literal">adjust_type</code> entry controls adjustmentsmade to the end of an automatically calculated plot range.See <a class="xref" href="TuneXAutoRange.html" title="TuneXAutoRange"><span class="refentrytitle">TuneXAutoRange</span></a> and <a class="xref" href="TuneYAutoRange.html" title="TuneYAutoRange"><span class="refentrytitle">TuneYAutoRange</span></a>for more information.This is used to indicate when a plot type needs additional space, perhapsfor labels, between the data extrema and the edge of the plot area.If omitted, the default value 0 is used.A value of 0 means apply the adjustment for the dependent variable only.A value of 1 means apply the adjustment for both X and Y, and a value of2 means do not apply the adjustment to either X or Y.</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="var-rangectl"></a>10.2.6. rangectl[]</h3></div></div></div><p>The <code class="varname">rangectl[]</code> array contains parameters which are usedto control the automatic calculation of the plot area range.</p><p>The array contains 2 arrays, indexed as <code class="literal">'x'</code> and<code class="literal">'y'</code> for X and Y axis parameters respectively.The keys and values of the second-level arrays are:</p><div class="informaltable"><table summary="rangectl[] array elements" border="1"><colgroup><col class="c1" /><col class="c2" /><col class="c3" /></colgroup><thead><tr><th>Key</th><th>Default</th><th>Description</th></tr></thead><tbody><tr><td>zero_magnet</td><td>0.857142 (Note this is 6/7)</td><td>Strength of the <span class="emphasis"><em>zero magnet</em></span></td></tr><tr><td>adjust_mode</td><td>T</td><td>End adjustment mode: R, T, or I</td></tr><tr><td>adjust_amount</td><td>(Dynamic; see <a class="xref" href="dev-internal.html#GetRangeEndAdjust">GetRangeEndAdjust</a>)</td><td>Amount of end adjustment, as a fraction of the plot range</td></tr></tbody></table></div><p></p><p>Values in this array are set with<a class="xref" href="TuneXAutoRange.html" title="TuneXAutoRange"><span class="refentrytitle">TuneXAutoRange</span></a> and <a class="xref" href="TuneYAutoRange.html" title="TuneYAutoRange"><span class="refentrytitle">TuneYAutoRange</span></a>.For more information see <a class="xref" href="adv-autorange.html#adv-autorange-params" title="4.6.4. Automatic Range Parameters">Section 4.6.4, “Automatic Range Parameters”</a>.The values are used by <a class="xref" href="dev-internal.html#CalcPlotRange">CalcPlotRange</a>.</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="var-tickctl"></a>10.2.7. tickctl[]</h3></div></div></div><p>The <code class="varname">tickctl[]</code> array contains parameters which are usedto control the automatic calculation of tick intervals.</p><p>The array contains 2 arrays, indexed as <code class="literal">'x'</code> and<code class="literal">'y'</code> for X and Y axis parameters respectively.The keys and values of the second-level arrays are:</p><div class="informaltable"><table summary="tickctl[] array elements" border="1"><colgroup><col class="c1" /><col class="c2" /><col class="c3" /></colgroup><thead><tr><th>Key</th><th>Default</th><th>Description</th></tr></thead><tbody><tr><td>min_ticks</td><td>8</td><td>Minimum number of tick intervals</td></tr><tr><td>tick_mode</td><td>NULL (calculated)</td><td>Tick increment calculation mode: 'decimal', 'binary', or 'date'</td></tr><tr><td>tick_inc_integer</td><td>FALSE</td><td>If TRUE, force the tick increment to be a whole number</td></tr></tbody></table></div><p></p><p>Values in this array are set with<a class="xref" href="TuneXAutoTicks.html" title="TuneXAutoTicks"><span class="refentrytitle">TuneXAutoTicks</span></a> and <a class="xref" href="TuneYAutoTicks.html" title="TuneYAutoTicks"><span class="refentrytitle">TuneYAutoTicks</span></a>.For more information see <a class="xref" href="adv-autorange.html#adv-autorange-tick-params" title="4.6.8. Automatic Tick Increment Parameters">Section 4.6.8, “Automatic Tick Increment Parameters”</a>.The values are used by <a class="xref" href="dev-internal.html#CalcStep">CalcStep</a>.</p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="dev-vars.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="dev-vars.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="dev-const.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 10. PHPlot Class Member Variables </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 10.3. PHPlot Class Constants</td></tr></table></div></body></html>