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>2.3. A Simple Graph</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="starting.html" title="Chapter 2. Getting Started with PHPlot" /><link rel="prev" href="starting-create.html" title="2.2. Creating the Object" /><link rel="next" href="starting-more.html" title="2.4. Different Size Images and Titles" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">2.3. A Simple Graph</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="starting-create.html">Prev</a> </td><th width="60%" align="center">Chapter 2. Getting Started with PHPlot</th><td width="20%" align="right"> <a accesskey="n" href="starting-more.html">Next</a></td></tr></table><hr /></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="starting-simple"></a>2.3. A Simple Graph</h2></div></div></div><p>
3
We will start with a simple line graph.
4
</p><pre class="programlisting">&lt;?php
5
//Include the code
6
require_once 'phplot.php';
7
 
8
//Define the object
9
$plot = new PHPlot();
10
 
11
//Define some data
12
$example_data = array(
13
     array('a',3),
14
     array('b',5),
15
     array('c',7),
16
     array('d',8),
17
     array('e',2),
18
     array('f',6),
19
     array('g',7)
20
);
21
$plot-&gt;SetDataValues($example_data);
22
 
23
//Turn off X axis ticks and labels because they get in the way:
24
$plot-&gt;SetXTickLabelPos('none');
25
$plot-&gt;SetXTickPos('none');
26
 
27
//Draw it
28
$plot-&gt;DrawGraph();
29
</pre><p>
30
 
31
</p><p>
32
 
33
And that's it! What we get is the following graph:
34
 
35
</p><div class="informalfigure"><div class="mediaobject"><img src="examples/qs1.png" alt="Simple line graph" /></div></div><p>
36
</p><p>
37
That's a great start, but now we would like to specify the width and height
38
of the image, and add some titles.
39
</p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="starting-create.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="starting.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="starting-more.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">2.2. Creating the Object </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 2.4. Different Size Images and Titles</td></tr></table></div></body></html>