Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
// $Id: barintex2.php,v 1.2 2002/07/11 23:27:28 aditus Exp $
3
include ("../jpgraph.php");
4
include ("../jpgraph_bar.php");
5
 
6
// Some data
7
$datay=array(3,1,7,5,12,11,9,4,17);
8
 
9
// Create the graph and setup the basic parameters
10
$graph = new Graph(460,200,'auto');
11
$graph->img->SetMargin(40,30,40,40);
12
$graph->SetScale("textint");
13
$graph->SetFrame(true,'blue',1);
14
$graph->SetColor('lightblue');
15
$graph->SetMarginColor('lightblue');
16
 
17
// Add some grace to the top so that the scale doesn't
18
// end exactly at the max value.
19
$graph->yaxis->scale->SetGrace(20);
20
 
21
// Setup X-axis labels
22
$a = $gDateLocale->GetShortMonth();
23
$graph->xaxis->SetTickLabels($a);
24
$graph->xaxis->SetFont(FF_FONT1);
25
$graph->xaxis->SetColor('darkblue','black');
26
 
27
// Stup "hidden" y-axis by given it the same color
28
// as the background
29
$graph->yaxis->SetColor('lightblue','darkblue');
30
$graph->ygrid->SetColor('white');
31
 
32
// Setup graph title ands fonts
33
$graph->title->Set('Example of integer Y-scale');
34
$graph->subtitle->Set('(With "hidden" y-axis)');
35
 
36
$graph->title->SetFont(FF_FONT2,FS_BOLD);
37
$graph->xaxis->title->Set("Year 2002");
38
$graph->xaxis->title->SetFont(FF_FONT2,FS_BOLD);
39
 
40
// Create a bar pot
41
$bplot = new BarPlot($datay);
42
$bplot->SetFillColor('darkblue');
43
$bplot->SetColor('darkblue');
44
$bplot->SetWidth(0.5);
45
$bplot->SetShadow('darkgray');
46
 
47
// Setup the values that are displayed on top of each bar
48
$bplot->value->Show();
49
// Must use TTF fonts if we want text at an arbitrary angle
50
$bplot->value->SetFont(FF_ARIAL,FS_NORMAL,8);
51
$bplot->value->SetFormat('$%d');
52
// Black color for positive values and darkred for negative values
53
$bplot->value->SetColor("black","darkred");
54
$graph->Add($bplot);
55
 
56
// Finally stroke the graph
57
$graph->Stroke();
58
?>