Subversion Repositories Applications.gtt

Rev

Rev 61 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
60 jpm 1
<?php
2
require_once '../../BarPlot.class.php';
3
 
4
$graph = new Graph(600, 200);
5
$graph->setAntiAliasing(TRUE);
6
 
7
$values = array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0);
8
 
9
$plot = new BarPlot($values);
10
$plot->setBarColor(
11
	new Color(234, 236, 255)
12
);
13
$plot->setSpace(5, 5, NULL, NULL);
14
 
15
$plot->barShadow->setSize(3);
16
$plot->barShadow->setPosition(Shadow::RIGHT_TOP);
17
$plot->barShadow->setColor(new Color(180, 180, 180, 10));
18
$plot->barShadow->smooth(TRUE);
19
 
20
 
21
$mois = array ('Jan', 'Fév', 'Mar', 'Avr', 'Mai', 'Jun', 'Juil', 'Août', 'Sept', 'Oct', 'Nov', 'Déc');
22
$label = array ();
23
foreach ($mois as $m) { $label []= $m; }
24
$label []= ' ';
25
foreach ($mois as $m) { $label []= $m; }
26
 
27
 
28
$plot->xAxis->setLabelText($label);
29
 
30
/* ICI */
31
 
32
   $max = array_max($values);
33
   $yValues = array();
34
   for($i=0; $i<= $max; $i++) {
35
	$yValues[]=$i;
36
   }
37
   $plot->yAxis->setLabelText($yValues);
38
 
39
  // Image::drawError(var_export($yValues, TRUE));
40
$plot->yAxis->setLabelText($yValues);
41
 
42
$plot->setPadding(30,5,20,15);
43
 
44
$labelAvant = new Label("2005");
45
$labelAvant->setFont (new TTFFont(ARTICHOW_FONT.'/TuffyBold.ttf', 12));
46
$labelAvant->move (180,10);
47
 
48
$labelMaintenant = new Label("2006");
49
$labelMaintenant->setFont (new TTFFont(ARTICHOW_FONT.'/TuffyBold.ttf', 12));
50
$labelMaintenant->move (450,10);
51
 
52
$graph->add($plot);
53
$graph->addLabel($labelAvant, 0, 0);
54
$graph->addLabel($labelMaintenant, 0, 0);
55
 
56
$graph->draw();
57
 
58
?>