Rev | Line | |
---|
[42] | 1 | <?php // content="text/plain; charset=utf-8"
|
---|
| 2 | require_once ('jpgraph/jpgraph.php');
|
---|
| 3 | require_once ('jpgraph/jpgraph_line.php');
|
---|
| 4 |
|
---|
| 5 | $ydata = array(11,-3,-8,7,5,-1,9,13,5,-7);
|
---|
| 6 |
|
---|
| 7 | // Create the graph. These two calls are always required
|
---|
| 8 | $graph = new Graph(300,200);
|
---|
| 9 | $graph->SetScale("textlin");
|
---|
| 10 |
|
---|
| 11 | // Create the linear plot
|
---|
| 12 | $lineplot=new LinePlot($ydata);
|
---|
| 13 |
|
---|
| 14 | $lineplot->value->Show();
|
---|
| 15 | $lineplot->value->SetColor("red");
|
---|
| 16 | $lineplot->value->SetFont(FF_FONT1,FS_BOLD);
|
---|
| 17 |
|
---|
| 18 |
|
---|
| 19 | // Add the plot to the graph
|
---|
| 20 | $graph->Add($lineplot);
|
---|
| 21 |
|
---|
| 22 | $graph->img->SetMargin(40,20,20,40);
|
---|
| 23 | $graph->title->Set("Example 2.1");
|
---|
| 24 | $graph->xaxis->title->Set("X-title");
|
---|
| 25 | $graph->yaxis->title->Set("Y-title");
|
---|
| 26 |
|
---|
| 27 |
|
---|
| 28 | // Display the graph
|
---|
| 29 | $graph->Stroke();
|
---|
| 30 | ?>
|
---|
Note:
See
TracBrowser
for help on using the repository browser.