Subversion Repositories cheapmusic

Rev

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>5.48. Example - Horizontal Linepoints Plot with Data Value Labels and Lines</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="examples.html" title="Chapter 5. PHPlot Examples" /><link rel="prev" href="ex-pieangle.html" title="5.47. Example - Pie Chart Start Angle and Direction" /><link rel="next" href="ex-horizerror.html" title="5.49. Example - Horizontal Error Plot" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">5.48. Example - Horizontal Linepoints Plot with Data Value Labels and Lines</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ex-pieangle.html">Prev</a> </td><th width="60%" align="center">Chapter 5. PHPlot Examples</th><td width="20%" align="right"> <a accesskey="n" href="ex-horizerror.html">Next</a></td></tr></table><hr /></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="ex-horizlinepts"></a>5.48. Example - Horizontal Linepoints Plot with Data Value Labels and Lines</h2></div></div></div><p>
This is a horizontal 'linepoints' plot.
In a horizontal plot, the Y (vertical) axis is for the independent values,
and the X axis (horizontal) is for the dependent values, so PHPlot is
graphing <span class="mathphrase">X = F(Y)</span>.
</p><p>
This plot has:
  </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
Y axis data labels, which show the values from the label positions in the data
array along the Y axis
(see <a class="xref" href="SetYDataLabelPos.html" title="SetYDataLabelPos"><span class="refentrytitle">SetYDataLabelPos</span></a>, not used in the example below
because the default is to plot labels along the Y axis if they are not
empty)
      </p></li><li class="listitem"><p>
X data value labels, which show the X value just above each data point
(see <a class="xref" href="SetXDataLabelPos.html" title="SetXDataLabelPos"><span class="refentrytitle">SetXDataLabelPos</span></a>)
      </p></li><li class="listitem"><p>
Y data label lines, which connect the data points horizontally to the Y
axis data labels (see <a class="xref" href="SetDrawYDataLabelLines.html" title="SetDrawYDataLabelLines"><span class="refentrytitle">SetDrawYDataLabelLines</span></a>)
      </p></li></ul></div><p>
</p><p>
Note: Horizontal linepoints plots were added in PHPlot-6.0.0.
</p><div class="example"><a id="example-horizlinepts"></a><p class="title"><strong>Example 5.48. Horizontal Linepoints Plot with Data Value Labels and Lines</strong></p><div class="example-contents"><div class="informalfigure"><div class="mediaobject"><img src="examples/horizlinepts.png" alt="Horizontal Linepoints Plot with Data Value Labels and Lines Example" /></div></div><pre class="programlisting">&lt;?php
# PHPlot Example - Horizontal linepoints plot with Y Data Label Lines
require_once 'phplot.php';

$data = array(
            array("SEA\nLEVEL", 0, ''),
            array('100m', 1, 10),
            array('200m', 2, 22),
            array('300m', 3, 30),
            array('400m', 4, 46),
            array('500m', 5, 53),
            array('600m', 6, 65),
            array('700m', 7, 70),
            array('800m', 8, 50),
            array('900m', 9, 35),
        );

$plot = new PHPlot(800, 600);
$plot-&gt;SetImageBorderType('plain'); // Improves presentation in the manual
$plot-&gt;SetTitle('Wind Speed at Altitude');
$plot-&gt;SetDataType('data-data-yx');
$plot-&gt;SetDataValues($data);
$plot-&gt;SetPlotType('linepoints');
$plot-&gt;SetPlotAreaWorld(0, 0, 100, 10);
$plot-&gt;SetDrawYDataLabelLines(True);
$plot-&gt;SetXTitle('Wind Speed');
$plot-&gt;SetYTitle('Altitude');
$plot-&gt;SetYTickLabelPos('none');
$plot-&gt;SetYTickPos('none');
$plot-&gt;SetXDataLabelPos('plotin');
$plot-&gt;SetDrawXGrid(False);
$plot-&gt;SetDrawYGrid(False);
$plot-&gt;DrawGraph();
</pre></div></div><br class="example-break" /></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ex-pieangle.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="examples.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ex-horizerror.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">5.47. Example - Pie Chart Start Angle and Direction </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 5.49. Example - Horizontal Error Plot</td></tr></table></div></body></html>