| 1 |
lars |
1 |
<?php
|
|
|
2 |
include ("../jpgraph.php");
|
|
|
3 |
include ("../jpgraph_line.php");
|
|
|
4 |
|
|
|
5 |
$datay1 = array(11,7,5,8,3,5,5,4,8,6,5,5,3,2,5,1,2,0);
|
|
|
6 |
$datay2 = array( 4,5,4,5,6,5,7,4,7,4,4,3,2,4,1,2,2,1);
|
|
|
7 |
$datay3 = array(4,5,7,10,13,15,15,22,26,26,30,34,40,43,47,55,60,62);
|
|
|
8 |
|
|
|
9 |
// Create the graph. These two calls are always required
|
|
|
10 |
$graph = new Graph(300,200,"auto");
|
|
|
11 |
$graph->SetScale("textlin");
|
|
|
12 |
$graph->SetShadow();
|
|
|
13 |
$graph->img->SetMargin(40,30,20,40);
|
|
|
14 |
|
|
|
15 |
// Create the linear plots for each category
|
|
|
16 |
$dplot[] = new LinePLot($datay1);
|
|
|
17 |
$dplot[] = new LinePLot($datay2);
|
|
|
18 |
$dplot[] = new LinePLot($datay3);
|
|
|
19 |
|
|
|
20 |
$dplot[0]->SetFillColor("red");
|
|
|
21 |
$dplot[1]->SetFillColor("blue");
|
|
|
22 |
$dplot[2]->SetFillColor("green");
|
|
|
23 |
|
|
|
24 |
// Create the accumulated graph
|
|
|
25 |
$accplot = new AccLinePlot($dplot);
|
|
|
26 |
|
|
|
27 |
// Add the plot to the graph
|
|
|
28 |
$graph->Add($accplot);
|
|
|
29 |
|
|
|
30 |
$graph->xaxis->SetTextTickInterval(2);
|
|
|
31 |
$graph->title->Set("Example 17");
|
|
|
32 |
$graph->xaxis->title->Set("X-title");
|
|
|
33 |
$graph->yaxis->title->Set("Y-title");
|
|
|
34 |
|
|
|
35 |
$graph->title->SetFont(FF_FONT1,FS_BOLD);
|
|
|
36 |
$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
|
|
|
37 |
$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
|
|
|
38 |
|
|
|
39 |
// Display the graph
|
|
|
40 |
$graph->Stroke();
|
|
|
41 |
?>
|