Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
include ("../jpgraph.php");
3
include ("../jpgraph_line.php");
4
 
5
$n = 8;
6
for($i=0; $i < $n; ++$i ) {
7
    $datay[$i] = rand(1,10);
8
    $datay2[$i] = rand(10,55);
9
    $datay3[$i] = rand(200,600);
10
    $datay4[$i] = rand(521,655);
11
}
12
 
13
$datay4[0] = 520;
14
$datay4[7] = 660;
15
 
16
// Setup the graph
17
$graph = new Graph(450,250);
18
$graph->SetMargin(40,150,40,30);
19
$graph->SetMarginColor('white');
20
 
21
$graph->SetScale('intlin');
22
$graph->title->Set('Using multiple Y-axis');
23
$graph->title->SetFont(FF_ARIAL,FS_NORMAL,14);
24
 
25
$graph->SetYScale(0,'lin');
26
$graph->SetYScale(1,'lin');
27
$graph->SetYScale(2,'lin');
28
 
29
$p1 = new LinePlot($datay);
30
$graph->Add($p1);
31
 
32
$p2 = new LinePlot($datay2);
33
$p2->SetColor('teal');
34
$graph->AddY(0,$p2);
35
$graph->ynaxis[0]->SetColor('teal');
36
 
37
$p3 = new LinePlot($datay3);
38
$p3->SetColor('red');
39
$graph->AddY(1,$p3);
40
$graph->ynaxis[1]->SetColor('red');
41
 
42
$p4 = new LinePlot($datay4);
43
$p4->SetColor('blue');
44
$graph->AddY(2,$p4);
45
$graph->ynaxis[2]->SetColor('blue');
46
 
47
// Output line
48
$graph->Stroke();
49
?>
50
 
51