Changeset 1472
- Timestamp:
- Sep 28, 2010, 7:34:40 PM (10 years ago)
- Location:
- cpc/trunk/project
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
cpc/trunk/project/apps/frontend/modules/parlementaire/config/view.yml
r1439 r1472 1 1 listCircoSuccess: 2 2 javascripts: [jquery.maphilight.min.js] 3 indexSuccess: 4 javascripts: [overlib.js, pMap.js] 3 5 showSuccess: 4 6 javascripts: [overlib.js, pMap.js] -
cpc/trunk/project/apps/frontend/modules/plot/actions/components.class.php
r1463 r1472 157 157 $this->data = array(); 158 158 $this->data['groupes'] = array('UMP' => array(),'NC' => array(),'SRC' => array(),'GDR' => array(), 'NI' => array()); 159 $this->data['titres'] = array(" Députés", "Interventions", "Amendements", "Propositions", "Quest. Orales", "Quest. Écrites");159 $this->data['titres'] = array(" Députés", "Interventions", "Amendements", "Propositions", "Quest. Orales", "Quest. Écrites"); 160 160 $n = count($this->data['titres']); 161 161 $stats = unserialize(Doctrine::getTable('VariableGlobale')->findOneByChamp('stats_groupes')->value); … … 193 193 $this->data['totaux'][$i] += $this->data['groupes'][$groupe][$i]; 194 194 foreach ($this->data['groupes'] as $groupe => $arr) 195 for ($i=0;$i<$n;$i++) 196 $this->data['groupes'][$groupe][$i] = $this->data['groupes'][$groupe][$i] / $this->data['totaux'][$i] * 100; 195 for ($i=0;$i<$n;$i++) { 196 $tmp = round($this->data['groupes'][$groupe][$i] / $this->data['totaux'][$i] * 1000)/10; 197 $this->data['groupes'][$groupe][$i] = round($this->data['groupes'][$groupe][$i] / $this->data['totaux'][$i] * 1000)/10; 198 } 199 for ($i=0;$i<$n;$i++) 200 $this->data['totaux'][$i] = preg_replace('/(\d)(\d{3})$/', '\\1 \\2', $this->data['totaux'][$i]); 197 201 } 198 202 -
cpc/trunk/project/apps/frontend/modules/plot/templates/_newGroupes.php
r1463 r1472 2 2 <?php $PictureID = "Map_".rand(1,10000).".map"; ?> 3 3 <a href="<?php echo url_for('@top_global'); ?>"> 4 <img id="graph_groupes ?>" alt="Répartition de l'activité parlementaire sur les 12 derniers mois" src="<?php echo url_for('@groupes_plot_graph?mapId='.$PictureID); ?>" OnMouseMove="getMousePosition(event);" OnMouseOut="nd();"/>4 <img id="graph_groupes" alt="Répartition de l'activité parlementaire sur les 12 derniers mois" src="<?php echo url_for('@groupes_plot_graph?mapId='.$PictureID); ?>" OnMouseMove="getMousePosition(event);" OnMouseOut="nd();"/> 5 5 </a> 6 <script> LoadImageMap("graph_groupes ; ?>", "<?php echo url_for('@groupes_plot_graph?drawAction=map&mapId='.$PictureID); ?>"); </script>6 <script> LoadImageMap("graph_groupes", "<?php echo url_for('@groupes_plot_graph?drawAction=map&mapId='.$PictureID); ?>"); </script> 7 7 <?php echo include_partial('plot/groupesLegende', array()); ?> -
cpc/trunk/project/apps/frontend/modules/plot/templates/generatePlotGroupesSuccess.php
r1463 r1472 1 1 <?php 2 2 3 $data = unserialize(get_component('plot', 'groupesData')); 3 $data = unserialize(get_component('plot', 'getGroupesData')); 4 $xsize = 433; $ysize = 300 ; $font = 8; 4 5 5 $data['groupes']; 6 $data['totaux']; 7 $data['titres']; 8 9 $n = count($data['titres']); 10 11 $xsize = 390; 12 $xtitre = 80; $ysize = 300; $ylegend = 145; $x0 = 140; $y0 = 112; 13 $ticks = 12.5; 14 $scale = 14; 15 16 if ($drawAction === "map" ) { 17 $Test = new xsPChart(800,$size); 6 if ($drawAction === "map") { 7 $Test = new xsPChart($xsize,$ysize); 18 8 $Test->getImageMap($mapId); 19 9 } … … 21 11 $DataSet = new xsPData(); 22 12 $DataSet->AddPoint($data['titres'], "Serie1"); 23 $DataSet->AddPoint($presences, "Serie2"); 24 $DataSet->AddPoint($participations, "Serie3"); 25 $DataSet->AddPoint($mots, "Serie4"); 26 $DataSet->AddSerie("Serie2"); 27 $DataSet->AddSerie("Serie3"); 28 $DataSet->AddSerie("Serie4"); 13 $ct = 2; 14 foreach ($data['groupes'] as $groupe => $values) { 15 $serie = "Serie".$ct; 16 $DataSet->AddPoint($values, $serie); 17 $DataSet->AddSerie($serie); 18 $DataSet->SetSerieName($groupe, $serie); 19 $ct++; 20 } 29 21 $DataSet->SetAbsciseLabelSerie("Serie1"); 30 $DataSet->SetYAxisName("Séances par semaine"); 31 32 $DataSetLegend = new xsPData(); 33 $DataSetLegend->AddPoint($data['labels'], "Serie1"); 34 $DataSetLegend->AddPoint($presences, "Serie2"); 35 $DataSetLegend->AddPoint($participations, "Serie3"); 36 $DataSetLegend->AddSerie("Serie2"); 37 $DataSetLegend->AddSerie("Serie3"); 38 $DataSetLegend->SetSerieName(utf8_decode('Présences'),"Serie2"); 39 $DataSetLegend->SetSerieName("Participations","Serie3"); 40 $DataSetLegend->SetAbsciseLabelSerie("Serie1"); 41 42 $DataSetBordure = new xsPData(); 43 $DataSetBordure->AddPoint($data['labels'], "Serie1"); 44 $DataSetBordure->AddPoint($presences, "Serie2"); 45 $DataSetBordure->AddPoint(array_fill(1, count($data['labels']), 0), "Serie5"); 46 $DataSetBordure->AddSerie("Serie2"); 47 $DataSetBordure->AddSerie("Serie5"); 48 $DataSetBordure->SetAbsciseLabelSerie("Serie1"); 22 $DataSet->SetYAxisUnit(" %"); 49 23 50 24 $DataSet2 = new xsPData(); 51 $DataSet2->AddPoint($data['labels'], "Serie1"); 52 $DataSet2->AddPoint($data['vacances'], "Serie6"); 53 $DataSet2->AddSerie("Serie6"); 54 $DataSet2->SetAbsciseLabelSerie("Serie1"); 55 56 if ($questions === 'true' && $type != 'commission') { 57 $DataSet3 = new xsPData(); 58 $DataSet3->AddPoint($data['labels'], "Serie1"); 59 $DataSet3->AddPoint($data['n_questions'], "Serie7"); 60 $DataSet3->AddSerie("Serie7"); 61 $DataSet3->SetAbsciseLabelSerie("Serie1"); 62 $Data3 = $DataSet3->GetData(); 63 $DataDescr3 = $DataSet3->GetDataDescription(); 64 } 25 $DataSet2->AddPoint($data['totaux'], "Serie".$ct); 26 $DataSet2->SetAbsciseLabelSerie("Serie".$ct); 27 $DataSet2->SetYAxisUnit(" %"); 65 28 66 29 $Data = $DataSet->GetData(); 67 30 $DataDescr = $DataSet->GetDataDescription(); 68 $DataBordure = $DataSetBordure->GetData(); 69 $DataDescrBordure = $DataSetBordure->GetDataDescription(); 70 $Data2 = $DataSet2->GetData(); 31 $Data2 = $DataSet2->getData(); 71 32 $DataDescr2 = $DataSet2->GetDataDescription(); 72 $DataLegend = $DataSetLegend->GetData();73 $DataDescrLegend = $DataSetLegend->GetDataDescription();74 33 75 $Test = new xsPChart(800,$size); 76 $Test->setGraphArea(25+3*$font,3*$font,780,$size-10-2*$font); 77 $Test->drawFilledRoundedRectangle(7,7,793,$size-7,5,240,240,240); 78 $Test->drawRoundedRectangle(5,5,795,$size - 5,5,230,230,230); 79 $Test->drawGraphArea(230,230,230,FALSE); 80 $Test->setFixedScale(0,$scale,$scale/$ticks); 34 $Test = new xsPChart($xsize,$ysize); 35 $Test->setGraphArea(40+2*$font,15+4*$font,$xsize-20,$ysize-4*$font); 36 $Test->drawFilledRectangle(7,7,$xsize-7,$ysize-7,240,240,240); 37 $Test->drawGraphArea(190,190,190,FALSE); 38 $Test->setFixedScale(0,100.7,4); 81 39 $Test->xsSetFontProperties("tahoma.ttf",$font); 82 $Test->drawScale($Data,$DataDescr,SCALE_NORMAL,50,50,50,TRUE,0,0,FALSE,1,TRUE); 83 if ($link === 'true') { 84 $Test->setColorPalette(0,255,255,255); 85 $Test->setColorPalette(1,255,255,255); 86 $Test->setImageMap(TRUE,$mapId); 87 $Test->drawOverlayBarGraph($DataLegend,$DataDescrLegend,30,100); 88 $Test->setImageMap(FALSE,$mapId); 89 } 90 $Test->drawGrid(0,TRUE,0,0,0,100); 91 $Test->setColorPalette(0,50,50,50); 92 $Test->drawOverlayBarGraph($Data2,$DataDescr2,30,100); 93 $Test->setColorPalette(0,255,0,0); 94 $Test->setColorPalette(1,255,255,0); 95 $Test->setColorPalette(2,0,255,0); 96 $Test->drawFilledLineGraph($Data,$DataDescr,78); 97 if ($questions === 'true' && $type != 'commission') { 98 $Test->setColorPalette(0,0,0,255); 99 $Test->drawOverlayBarGraph($Data3,$DataDescr3,85,25); 100 } 101 $Test->setColorPalette(0,255,0,0); 102 $Test->setColorPalette(1,0,0,0); 103 $Test->drawLineGraph($DataBordure,$DataDescrBordure); 40 $Test->drawScale($Data2,$DataDescr2,SCALE_NORMAL,50,50,50,TRUE,0,0,TRUE,1,FALSE); 41 $Test->drawScale($Data,$DataDescr,SCALE_NORMAL,50,50,50,TRUE,16,0,TRUE,1,TRUE); 42 $Test->xsSetFontProperties("tahoma.ttf",$font+1); 43 $Test->drawTitle(4+2*$font,$ysize-4*$font+18, "TOTAL :",50,50,50); 44 $Test->drawGrid(4,TRUE,0,0,0,40); 45 $Test->setColorPalette(0,30,30,200); 46 $Test->setColorPalette(1,30,190,255); 47 $Test->setColorPalette(2,255,50,190); 48 $Test->setColorPalette(3,255,30,30); 49 $Test->setColorPalette(4,130,130,130); 50 $Test->setImageMap(TRUE,$mapId); 51 $Test->drawStackedBarGraph($Data,$DataDescr,75,90); 104 52 105 $Test->xsSetFontProperties("tahoma.ttf",$font + 3); 106 $pos_titre = 240; 107 if ($time === 'lastyear') { 108 if (isset($data['mandat_clos'])) { 109 $pos_titre = 210; 110 $duree = ' sa dernière année de mandat'; 111 } else $duree = 's 12 derniers mois'; 112 $shortduree = 'annee'; 113 } else { 114 $duree = " la session ".preg_replace('/^(\d{4})/', '\\1-', $time); 115 $shortduree = $time; 116 } 117 if ($type === 'total') { 118 $Test->drawTitle($pos_titre,3 + 2*$font,"Participation globale au cours de".$duree." (hémicycle et commissions)",50,50,50,585); 119 $titre = 'globale-'.$shortduree; 120 } else { 121 $titre = $type; 122 if ($type === 'commission') $titre .= 's'; 123 $Test->drawTitle($pos_titre+30,3 + 2*$font,"Participation en ".$titre." au cours de".$duree,50,50,50,585); 124 $titre .= '-'.$shortduree; 125 } 126 if ($link === 'true') 127 $Test->setImageMap(TRUE,$mapId); 53 //$Test->drawTitle($pos_titre,3 + 2*$font,"Participation globale au cours de".$duree." (hémicycle et commissions)",50,50,50,585); 128 54 129 55 $Test->xsStroke(); -
cpc/trunk/project/apps/frontend/modules/plot/templates/generatePlotParlementaireSuccess.php
r1439 r1472 103 103 $Test->setFixedScale(0,$scale,$scale/$ticks); 104 104 $Test->xsSetFontProperties("tahoma.ttf",$font); 105 $Test->drawScale($Data,$DataDescr,SCALE_NORMAL,50,50,50,TRUE,0,0,FALSE,1, TRUE);105 $Test->drawScale($Data,$DataDescr,SCALE_NORMAL,50,50,50,TRUE,0,0,FALSE,1,FALSE); 106 106 if ($link === 'true') { 107 107 $Test->setColorPalette(0,255,255,255); -
cpc/trunk/project/plugins/xsPChartPlugin/lib/pChart/pChart/pChart.class
r1439 r1472 290 290 291 291 /* Compute and draw the scale */ 292 function drawScale(&$Data,&$DataDescription,$ScaleMode,$R,$G,$B,$DrawTicks=TRUE,$Angle=0,$Decimals=1,$WithMargin=FALSE,$SkipLabels=1 )292 function drawScale(&$Data,&$DataDescription,$ScaleMode,$R,$G,$B,$DrawTicks=TRUE,$Angle=0,$Decimals=1,$WithMargin=FALSE,$SkipLabels=1,$TopAxis=FALSE) 293 293 { 294 294 /* Validate the Data and DataDescription array */ … … 298 298 299 299 $this->drawLine($this->GArea_X1,$this->GArea_Y1,$this->GArea_X1,$this->GArea_Y2,$R,$G,$B); 300 $this->drawLine($this->GArea_X1,$this->GArea_Y2,$this->GArea_X2,$this->GArea_Y2,$R,$G,$B); 300 if ($TopAxis == FALSE) 301 $this->drawLine($this->GArea_X1,$this->GArea_Y2,$this->GArea_X2,$this->GArea_Y2,$R,$G,$B); 302 else $this->drawLine($this->GArea_X1,$this->GArea_Y1,$this->GArea_X2,$this->GArea_Y1,$R,$G,$B); 301 303 302 304 if ( $this->VMin == NULL && $this->VMax == NULL) … … 467 469 $XPos = $this->GArea_X1 + $this->GAreaXOffset; 468 470 $ID = 1; $YMax = NULL; 471 if ($TopAxis == FALSE) { 472 $YAxisPos = $this->GArea_Y2; 473 $YAxisOrt = 1; 474 $YLegShift = 10; 475 } else { 476 $YAxisPos = $this->GArea_Y1; 477 $YAxisOrt = -1; 478 $YLegShift = 7; 479 } 469 480 foreach ( $Data as $Key => $Values ) 470 481 { 471 482 if ( $ID % $SkipLabels == 0 ) 472 483 { 473 $this->drawLine(floor($XPos),$ this->GArea_Y2,floor($XPos),$this->GArea_Y2+5,$R,$G,$B);484 $this->drawLine(floor($XPos),$YAxisPos,floor($XPos),$YAxisPos+$YAxisOrt*5,$R,$G,$B); 474 485 $Value = $Data[$Key][$DataDescription["Position"]]; 475 486 if ( $DataDescription["Format"]["X"] == "number" ) … … 488 499 if ( $Angle == 0 ) 489 500 { 490 $YPos = $ this->GArea_Y2+18;501 $YPos = $YAxisPos+$YAxisOrt*18; 491 502 imagettftext($this->Picture,$this->FontSize,$Angle,floor($XPos)-floor($TextWidth/2),$YPos,$C_TextColor,$this->FontName,$Value); 492 503 } 493 504 else 494 505 { 495 $YPos = $ this->GArea_Y2+10+$TextHeight;506 $YPos = $YAxisPos+$YLegShift+$YAxisOrt*($TextHeight); 496 507 if ( $Angle <= 90 ) 497 imagettftext($this->Picture,$this->FontSize,$Angle,floor($XPos)-$TextWidth +5,$YPos,$C_TextColor,$this->FontName,$Value);508 imagettftext($this->Picture,$this->FontSize,$Angle,floor($XPos)-$TextWidth/2+5,$YPos,$C_TextColor,$this->FontName,$Value); 498 509 else 499 510 imagettftext($this->Picture,$this->FontSize,$Angle,floor($XPos)+$TextWidth+5,$YPos,$C_TextColor,$this->FontName,$Value);
Note: See TracChangeset
for help on using the changeset viewer.