Changeset 1472


Ignore:
Timestamp:
Sep 28, 2010, 7:34:40 PM (10 years ago)
Author:
goya
Message:

graphe d'accueil

Location:
cpc/trunk/project
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • cpc/trunk/project/apps/frontend/modules/parlementaire/config/view.yml

    r1439 r1472  
    11listCircoSuccess:
    22   javascripts: [jquery.maphilight.min.js]
     3indexSuccess:
     4   javascripts: [overlib.js, pMap.js]
    35showSuccess:
    46   javascripts: [overlib.js, pMap.js]
  • cpc/trunk/project/apps/frontend/modules/plot/actions/components.class.php

    r1463 r1472  
    157157    $this->data = array();
    158158    $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");
    160160    $n = count($this->data['titres']);
    161161    $stats = unserialize(Doctrine::getTable('VariableGlobale')->findOneByChamp('stats_groupes')->value);
     
    193193        $this->data['totaux'][$i] += $this->data['groupes'][$groupe][$i];
    194194    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]);
    197201  }
    198202
  • cpc/trunk/project/apps/frontend/modules/plot/templates/_newGroupes.php

    r1463 r1472  
    22<?php $PictureID = "Map_".rand(1,10000).".map"; ?>
    33<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();"/>
    55</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>
    77<?php echo include_partial('plot/groupesLegende', array()); ?>
  • cpc/trunk/project/apps/frontend/modules/plot/templates/generatePlotGroupesSuccess.php

    r1463 r1472  
    11<?php
    22
    3 $data = unserialize(get_component('plot', 'groupesData'));
     3$data = unserialize(get_component('plot', 'getGroupesData'));
     4$xsize = 433; $ysize = 300 ; $font = 8;
    45
    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); 
     6if ($drawAction === "map") { 
     7  $Test = new xsPChart($xsize,$ysize); 
    188  $Test->getImageMap($mapId);
    199}
     
    2111$DataSet = new xsPData();
    2212$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;
     14foreach ($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}
    2921$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(" %");
    4923
    5024$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(" %");
    6528
    6629$Data = $DataSet->GetData();
    6730$DataDescr = $DataSet->GetDataDescription();
    68 $DataBordure = $DataSetBordure->GetData();
    69 $DataDescrBordure = $DataSetBordure->GetDataDescription();
    70 $Data2 = $DataSet2->GetData();
     31$Data2 = $DataSet2->getData();
    7132$DataDescr2 = $DataSet2->GetDataDescription();
    72 $DataLegend = $DataSetLegend->GetData();
    73 $DataDescrLegend = $DataSetLegend->GetDataDescription();
    7433
    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);
    8139$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);
    10452
    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);
    12854
    12955$Test->xsStroke();
  • cpc/trunk/project/apps/frontend/modules/plot/templates/generatePlotParlementaireSuccess.php

    r1439 r1472  
    103103$Test->setFixedScale(0,$scale,$scale/$ticks);
    104104$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);
    106106if ($link === 'true') {
    107107  $Test->setColorPalette(0,255,255,255);
  • cpc/trunk/project/plugins/xsPChartPlugin/lib/pChart/pChart/pChart.class

    r1439 r1472  
    290290
    291291   /* 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)
    293293    {
    294294     /* Validate the Data and DataDescription array */
     
    298298
    299299     $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);
    301303
    302304     if ( $this->VMin == NULL && $this->VMax == NULL)
     
    467469     $XPos = $this->GArea_X1 + $this->GAreaXOffset;
    468470     $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     }
    469480     foreach ( $Data as $Key => $Values )
    470481      {
    471482       if ( $ID % $SkipLabels == 0 )
    472483        {
    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);
    474485         $Value      = $Data[$Key][$DataDescription["Position"]];
    475486         if ( $DataDescription["Format"]["X"] == "number" )
     
    488499         if ( $Angle == 0 )
    489500          {
    490            $YPos = $this->GArea_Y2+18;
     501           $YPos = $YAxisPos+$YAxisOrt*18;
    491502           imagettftext($this->Picture,$this->FontSize,$Angle,floor($XPos)-floor($TextWidth/2),$YPos,$C_TextColor,$this->FontName,$Value);
    492503          }
    493504         else
    494505          {
    495            $YPos = $this->GArea_Y2+10+$TextHeight;
     506           $YPos = $YAxisPos+$YLegShift+$YAxisOrt*($TextHeight);
    496507           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);
    498509           else
    499510            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.