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
include ("../jpgraph_bar.php");
5
 
6
$l1datay = array(11,9,2,4,3,13,17);
7
$l2datay = array(23,12,5,19,17,10,15);
8
 
9
// Create the graph.
10
$graph = new Graph(400,200,"auto");
11
$graph->SetScale("intlin");
12
 
13
$graph->img->SetMargin(40,130,20,40);
14
$graph->SetShadow();
15
 
16
// Create the linear error plot
17
$l1plot=new LinePlot($l1datay);
18
$l1plot->SetColor("red");
19
$l1plot->SetWeight(2);
20
$l1plot->SetLegend("Prediction");
21
 
22
// Create the bar plot
23
$bplot = new BarPlot($l2datay);
24
$bplot->SetFillColor("orange");
25
$bplot->SetLegend("Result");
26
 
27
// Add the plots to t'he graph
28
$graph->Add($bplot);
29
$graph->Add($l1plot);
30
 
31
$graph->title->Set("Adding a line plot to a bar graph v3");
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
$datax = $gDateLocale->GetShortMonth();
40
$graph->xaxis->SetTickLabels($datax);
41
 
42
// Display the graph
43
$graph->Stroke();
44
?>