Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
 
3
include ("../jpgraph.php");
4
include ("../jpgraph_bar.php");
5
include ("../jpgraph_flags.php");
6
 
7
// Some data
8
$datay1=array(140,110,50);
9
$datay2=array(35,90,190);
10
$datay3=array(20,60,70);
11
 
12
// Create the basic graph
13
$graph = new Graph(300,200);
14
$graph->SetScale("textlin");
15
$graph->SetMargin(40,20,20,40);
16
$graph->SetMarginColor('white:0.9');
17
$graph->SetColor('white');
18
$graph->SetShadow();
19
 
20
 
21
// Adjust the position of the legend box
22
$graph->legend->Pos(0.03,0.10);
23
 
24
// Adjust the color for theshadow of the legend
25
$graph->legend->SetShadow('darkgray@0.5');
26
$graph->legend->SetFillColor('lightblue@0.1');
27
$graph->legend->Hide();
28
 
29
// Get localised version of the month names
30
$graph->xaxis->SetTickLabels($gDateLocale->GetShortMonth());
31
 
32
$graph->SetBackgroundCountryFlag('mais',BGIMG_COPY,50);
33
 
34
// Set axis titles and fonts
35
$graph->xaxis->title->Set('Year 2002');
36
$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
37
$graph->xaxis->title->SetColor('white');
38
 
39
$graph->xaxis->SetFont(FF_FONT1,FS_BOLD);
40
$graph->xaxis->SetColor('navy');
41
 
42
$graph->yaxis->SetFont(FF_FONT1,FS_BOLD);
43
$graph->yaxis->SetColor('navy');
44
 
45
//$graph->ygrid->Show(false);
46
$graph->ygrid->SetColor('white@0.5');
47
 
48
// Setup graph title
49
$graph->title->Set('Using a country flag background');
50
 
51
// Some extra margin (from the top)
52
$graph->title->SetMargin(3);
53
$graph->title->SetFont(FF_ARIAL,FS_NORMAL,12);
54
 
55
// Create the three var series we will combine
56
$bplot1 = new BarPlot($datay1);
57
$bplot2 = new BarPlot($datay2);
58
$bplot3 = new BarPlot($datay3);
59
 
60
// Setup the colors with 40% transparency (alpha channel)
61
$bplot1->SetFillColor('yellow@0.4');
62
$bplot2->SetFillColor('red@0.4');
63
$bplot3->SetFillColor('darkgreen@0.4');
64
 
65
// Setup legends
66
$bplot1->SetLegend('Label 1');
67
$bplot2->SetLegend('Label 2');
68
$bplot3->SetLegend('Label 3');
69
 
70
// Setup each bar with a shadow of 50% transparency
71
$bplot1->SetShadow('black@0.4');
72
$bplot2->SetShadow('black@0.4');
73
$bplot3->SetShadow('black@0.4');
74
 
75
$gbarplot = new GroupBarPlot(array($bplot1,$bplot2,$bplot3));
76
$gbarplot->SetWidth(0.6);
77
$graph->Add($gbarplot);
78
 
79
$graph->Stroke();
80
?>
81