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>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>We will start with a simple line graph.</p><pre class="programlisting"><?php//Include the coderequire_once 'phplot.php';//Define the object$plot = new PHPlot();//Define some data$example_data = array(array('a',3),array('b',5),array('c',7),array('d',8),array('e',2),array('f',6),array('g',7));$plot->SetDataValues($example_data);//Turn off X axis ticks and labels because they get in the way:$plot->SetXTickLabelPos('none');$plot->SetXTickPos('none');//Draw it$plot->DrawGraph();</pre><p></p><p>And that's it! What we get is the following graph:</p><div class="informalfigure"><div class="mediaobject"><img src="examples/qs1.png" alt="Simple line graph" /></div></div><p></p><p>That's a great start, but now we would like to specify the width and heightof the image, and add some titles.</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>