source: cpc/trunk/project/apps/frontend/modules/plot/templates/generatePlotGroupesSuccess.php @ 2677

Last change on this file since 2677 was 2117, checked in by roux, 9 years ago

adaptation ND

File size: 2.5 KB
Line 
1<?php
2
3$data = unserialize(get_component('plot', 'getGroupesData', array('type' => $type)));
4if ($type === "home") {
5  $xsize = 433;
6  $ydefsize = 320;
7  $yadd = 0;
8} else {
9  $xsize = 720;
10  $yadd = 16;
11  $ydefsize = 320;
12}
13$ysize = $ydefsize + $yadd;
14$font = 8;
15
16if ($drawAction === "map") { 
17  $Test = new xsPChart($xsize,$ysize); 
18  $Test->getImageMap($mapId, TRUE);
19}
20
21$DataSet = new xsPData();
22$DataSet->AddPoint($data['titres'], "Serie1");
23$ct = 2;
24foreach ($data['groupes'] as $groupe => $values) {
25  $serie = "Serie".$ct;
26  $DataSet->AddPoint($values, $serie);
27  $DataSet->AddSerie($serie);
28  $DataSet->SetSerieName($groupe, $serie);
29  $ct++;
30}
31$DataSet->SetAbsciseLabelSerie("Serie1");
32$DataSet->SetYAxisUnit(" %");
33
34$DataSet2 = new xsPData();
35$DataSet2->AddPoint($data['totaux'], "Serie".$ct);
36$DataSet2->SetAbsciseLabelSerie("Serie".$ct);
37$DataSet2->SetYAxisUnit(" %");
38
39$Data = $DataSet->GetData();
40$DataDescr = $DataSet->GetDataDescription();
41$Data2 = $DataSet2->getData();
42$DataDescr2 = $DataSet2->GetDataDescription();
43
44$Test = new xsPChart($xsize,$ysize);
45$Test->setGraphArea(40+2*$font,15+3*$font+$yadd,$xsize-20,$ysize-4*$font);
46$Test->drawFilledRectangle(7,7,$xsize-7,$ysize-7,240,240,240);
47$Test->drawGraphArea(190,190,190,FALSE);
48$Test->setFixedScale(0,100.7,4);
49$Test->xsSetFontProperties("tahoma.ttf",$font);
50$Test->drawScale($Data2,$DataDescr2,SCALE_NORMAL,50,50,50,TRUE,0,0,TRUE,1,FALSE);
51$Test->drawScale($Data,$DataDescr,SCALE_NORMAL,50,50,50,TRUE,0,0,TRUE,1,TRUE);
52$Test->xsSetFontProperties("tahoma.ttf",$font+1);
53$Test->drawTitle(4+2*$font,$ysize-4*$font+18, "TOTAL :",50,50,50);
54if ($type === "all") {
55  $Test->drawTitle(70,28,"Députés",50,50,50);
56  $Test->drawTitle(130,28,"Commission",50,50,50);
57  $Test->drawTitle(208,28,"Hémicycle interventions",50,50,50);
58  $Test->drawTitle(376,28,"Amendements",50,50,50); 
59  $Test->drawTitle(490,28,"Propositions",50,50,50); 
60  $Test->drawTitle(600,28,"Questions",50,50,50);
61  $Test->xsSetFontProperties("tahoma.ttf",$font+5);
62//  $Test->drawTitle(60,30,"Répartition de l'activité des députés sur les 12 derniers mois par groupe politique",25,25,25);
63}
64$Test->drawGrid(4,TRUE,0,0,0,30);
65$ct = 0;
66foreach ($data['couleurs'] as $col) if (preg_match('/^(\d+),(\d+),(\d+)$/', $col, $cols)) {
67  $Test->setColorPalette($ct,$cols[1],$cols[2],$cols[3]);
68  $ct++;
69}
70$Test->setImageMap(TRUE,$mapId);
71$Test->drawStackedBarGraph($Data,$DataDescr,75,90);
72
73//$Test->drawTitle($pos_titre,3 + 2*$font,"Participation globale au cours de".$duree." (hémicycle et commissions)",50,50,50,585);
74
75$Test->xsStroke();
76
77?>
Note: See TracBrowser for help on using the repository browser.