~pablocapeluto/cds-php/devel-3.1

« back to all changes in this revision

Viewing changes to jpgraph/src/Examples/example20.3.php

  • Committer: pcapeluto at gmail
  • Date: 2010-08-20 17:51:08 UTC
  • Revision ID: pcapeluto@gmail.com-20100820175108-jyi8dbyj15uy9p4i
Initial import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
include ("../jpgraph.php");
 
3
include ("../jpgraph_bar.php");
 
4
 
 
5
$datay=array(12,8,19,3,10,5);
 
6
 
 
7
// Create the graph. These two calls are always required
 
8
$graph = new Graph(300,200,"auto");     
 
9
$graph->SetScale("textlin");
 
10
$graph->yaxis->scale->SetGrace(20);
 
11
 
 
12
// Add a drop shadow
 
13
$graph->SetShadow();
 
14
 
 
15
// Adjust the margin a bit to make more room for titles
 
16
$graph->img->SetMargin(40,30,20,40);
 
17
 
 
18
// Create a bar pot
 
19
$bplot = new BarPlot($datay);
 
20
 
 
21
// Adjust fill color
 
22
$bplot->SetFillColor('orange');
 
23
$bplot->value->Show();
 
24
$bplot->value->SetFont(FF_ARIAL,FS_BOLD,10);
 
25
$bplot->value->SetAngle(45);
 
26
$bplot->value->SetFormat('%0.1f');
 
27
$graph->Add($bplot);
 
28
 
 
29
// Setup the titles
 
30
$graph->title->Set("Bar graph with Y-scale grace");
 
31
$graph->xaxis->title->Set("X-title");
 
32
$graph->yaxis->title->Set("Y-title");
 
33
 
 
34
$graph->title->SetFont(FF_FONT1,FS_BOLD);
 
35
$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
 
36
$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
 
37
 
 
38
// Display the graph
 
39
$graph->Stroke();
 
40
?>