| 1 |
lars |
1 |
<?php
|
|
|
2 |
include ("../jpgraph.php");
|
|
|
3 |
include ("../jpgraph_line.php");
|
|
|
4 |
|
|
|
5 |
$ydata = array(11,3,8,12,5,1,9,13,5,7);
|
|
|
6 |
$ydata2 = array(1,19,15,7,22,14,5,9,21,13);
|
|
|
7 |
|
|
|
8 |
// Create the graph. These two calls are always required
|
|
|
9 |
$graph = new Graph(300,200,"auto");
|
|
|
10 |
$graph->SetScale("textlin");
|
|
|
11 |
|
|
|
12 |
// Create the linear plot
|
|
|
13 |
$lineplot=new LinePlot($ydata);
|
|
|
14 |
|
|
|
15 |
$lineplot2=new LinePlot($ydata2);
|
|
|
16 |
|
|
|
17 |
// Add the plot to the graph
|
|
|
18 |
$graph->Add($lineplot);
|
|
|
19 |
$graph->Add($lineplot2);
|
|
|
20 |
|
|
|
21 |
$graph->img->SetMargin(40,20,20,40);
|
|
|
22 |
$graph->title->Set("Example 4");
|
|
|
23 |
$graph->xaxis->title->Set("X-title");
|
|
|
24 |
$graph->yaxis->title->Set("Y-title");
|
|
|
25 |
|
|
|
26 |
$graph->title->SetFont(FF_FONT1,FS_BOLD);
|
|
|
27 |
$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
|
|
|
28 |
$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
|
|
|
29 |
|
|
|
30 |
$lineplot->SetColor("blue");
|
|
|
31 |
$lineplot->SetWeight(2);
|
|
|
32 |
|
|
|
33 |
$lineplot2->SetColor("orange");
|
|
|
34 |
$lineplot2->SetWeight(2);
|
|
|
35 |
|
|
|
36 |
$graph->yaxis->SetColor("red");
|
|
|
37 |
$graph->yaxis->SetWeight(2);
|
|
|
38 |
$graph->SetShadow();
|
|
|
39 |
|
|
|
40 |
// Display the graph
|
|
|
41 |
$graph->Stroke();
|
|
|
42 |
?>
|