source: trunk/xgraph/jpgraph/Examples/bartutex4.php

Last change on this file was 42, checked in by marrucho, 10 years ago
File size: 1.1 KB
Line 
1<?php // content="text/plain; charset=utf-8"
2require_once ('jpgraph/jpgraph.php');
3require_once ('jpgraph/jpgraph_bar.php');
4
5// Some data
6$months=$gDateLocale->GetShortMonth();
7
8srand ((double) microtime() * 1000000);
9for( $i=0; $i<25; ++$i) {
10        $databary[]=rand(1,50);
11        $databarx[]=$months[$i%12];
12}
13       
14// New graph with a drop shadow
15$graph = new Graph(300,200,'auto');
16$graph->SetShadow();
17
18// Use a "text" X-scale
19$graph->SetScale("textlin");
20
21// Specify X-labels
22//$databarx = array('tXi','','','xxx','','','iXii','','','OOO','','','tOO');
23$graph->xaxis->SetFont(FF_FONT1,FS_NORMAL);
24$graph->xaxis->SetTickLabels($databarx);
25$graph->xaxis->SetTextLabelInterval(3);
26
27// Set title and subtitle
28$graph->title->Set("Displaying only every third label");
29
30// Use built in font
31$graph->title->SetFont(FF_FONT1,FS_BOLD);
32
33// Create the bar plot
34$b1 = new BarPlot($databary);
35$b1->SetLegend("Temperature");
36//$b1->SetAbsWidth(6);
37//$b1->SetShadow();
38
39// The order the plots are added determines who's ontop
40$graph->Add($b1);
41
42// Finally output the  image
43$graph->Stroke();
44
45?>
46
47
Note: See TracBrowser for help on using the repository browser.