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
$datax=$gDateLocale->GetShortMonth();
10
 
11
// Create the graph.
12
$graph = new Graph(400,200,"auto");
13
$graph->SetScale("textlin");
14
$graph->SetMargin(40,130,20,40);
15
$graph->SetShadow();
16
$graph->xaxis->SetTickLabels($datax);
17
 
18
// Create the linear error plot
19
$l1plot=new LinePlot($l1datay);
20
$l1plot->SetColor("red");
21
$l1plot->SetWeight(2);
22
$l1plot->SetLegend("Prediction");
23
 
24
//Center the line plot in the center of the bars
25
$l1plot->SetBarCenter();
26
 
27
 
28
// Create the bar plot
29
$bplot = new BarPlot($l2datay);
30
$bplot->SetFillColor("orange");
31
$bplot->SetLegend("Result");
32
 
33
// Add the plots to t'he graph
34
$graph->Add($bplot);
35
$graph->Add($l1plot);
36
 
37
 
38
$graph->title->Set("Adding a line plot to a bar graph v1");
39
$graph->xaxis->title->Set("X-title");
40
$graph->yaxis->title->Set("Y-title");
41
 
42
$graph->title->SetFont(FF_FONT1,FS_BOLD);
43
$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
44
$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
45
 
46
 
47
// Display the graph
48
$graph->Stroke();
49
?>