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_bar.php");
4
include ("../jpgraph_line.php");
5
 
6
// Some "random" data
7
$ydata  = array(10,120,80,190,260,170,60,40,20,230);
8
$ydata2 = array(10,70,40,120,200,60,80,40,20,5);
9
 
10
// Get a list of month using the current locale
11
$months = $gDateLocale->GetShortMonth();
12
 
13
// Create the graph.
14
$graph = new Graph(300,200);
15
$graph->SetScale("textlin");
16
$graph->SetMarginColor('white');
17
 
18
// Adjust the margin slightly so that we use the
19
// entire area (since we don't use a frame)
20
$graph->SetMargin(30,1,20,5);
21
 
22
// Box around plotarea
23
$graph->SetBox();
24
 
25
// No frame around the image
26
$graph->SetFrame(false);
27
 
28
// Setup the tab title
29
$graph->tabtitle->Set('Year 2003');
30
$graph->tabtitle->SetFont(FF_ARIAL,FS_BOLD,10);
31
 
32
// Setup the X and Y grid
33
$graph->ygrid->SetFill(true,'#DDDDDD@0.5','#BBBBBB@0.5');
34
$graph->ygrid->SetLineStyle('dashed');
35
$graph->ygrid->SetColor('gray');
36
$graph->xgrid->Show();
37
$graph->xgrid->SetLineStyle('dashed');
38
$graph->xgrid->SetColor('gray');
39
 
40
// Setup month as labels on the X-axis
41
$graph->xaxis->SetTickLabels($months);
42
$graph->xaxis->SetFont(FF_ARIAL,FS_NORMAL,8);
43
$graph->xaxis->SetLabelAngle(45);
44
 
45
// Create a bar pot
46
$bplot = new BarPlot($ydata);
47
$bplot->SetWidth(0.6);
48
$fcol='#440000';
49
$tcol='#FF9090';
50
 
51
$bplot->SetFillGradient($fcol,$tcol,GRAD_LEFT_REFLECTION);
52
 
53
// Set line weigth to 0 so that there are no border
54
// around each bar
55
$bplot->SetWeight(0);
56
 
57
$graph->Add($bplot);
58
 
59
// Create filled line plot
60
$lplot = new LinePlot($ydata2);
61
$lplot->SetFillColor('skyblue@0.5');
62
$lplot->SetColor('navy@0.7');
63
$lplot->SetBarCenter();
64
 
65
$lplot->mark->SetType(MARK_SQUARE);
66
$lplot->mark->SetColor('blue@0.5');
67
$lplot->mark->SetFillColor('lightblue');
68
$lplot->mark->SetSize(6);
69
 
70
$graph->Add($lplot);
71
 
72
// .. and finally send it back to the browser
73
$graph->Stroke();
74
?>