Ignore:
Timestamp:
Sep 26, 2010, 9:40:24 PM (10 years ago)
Author:
roux
Message:

legende over sur graphes, laborieeux sur multigraphes donc retiré

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpc/trunk/project/apps/frontend/modules/plot/templates/_plotParlementaire.php

    r1299 r1439  
    11<?php
    2 $DataSet = new xsPData();
    3 $DataSet->AddPoint($labels, "Serie1");
    4 $DataSet->AddPoint($presences, "Serie2");
    5 $DataSet->AddPoint($participations, "Serie3");
    6 $DataSet->AddPoint($mots, "Serie4");
    7 $DataSet->AddSerie("Serie2");
    8 $DataSet->AddSerie("Serie3");
    9 $DataSet->AddSerie("Serie4");
    10 $DataSet->SetAbsciseLabelSerie("Serie1");
    11 $DataSet->SetYAxisName("Séances par semaine");
    12 
    13 $DataSetBordure = new xsPData();
    14 $DataSetBordure->AddPoint($labels, "Serie1");
    15 $DataSetBordure->AddPoint($presences, "Serie2");
    16 $DataSetBordure->AddPoint(array_fill(1, count($labels), 0), "Serie5");
    17 $DataSetBordure->AddSerie("Serie2");
    18 $DataSetBordure->AddSerie("Serie5");
    19 $DataSetBordure->SetAbsciseLabelSerie("Serie1");
    20 
    21 $DataSet2 = new xsPData();
    22 $DataSet2->AddPoint($labels, "Serie1");
    23 $DataSet2->AddPoint($vacances, "Serie6");
    24 $DataSet2->AddSerie("Serie6");
    25 $DataSet2->SetAbsciseLabelSerie("Serie1");
    26 
    27 if (isset($n_questions) && $type != 'commission') {
    28   $questions = 1;
    29   $DataSet3 = new xsPData();
    30   $DataSet3->AddPoint($labels, "Serie1");
    31   $DataSet3->AddPoint($n_questions, "Serie7");
    32   $DataSet3->AddSerie("Serie7");
    33   $DataSet3->SetAbsciseLabelSerie("Serie1");
    34   $Data3 = $DataSet3->GetData();
    35   $DataDescr3 = $DataSet3->GetDataDescription();
    36 } else $questions = 0;
    37 
    38 $Data = $DataSet->GetData();
    39 $DataDescr = $DataSet->GetDataDescription();
    40 $DataBordure = $DataSetBordure->GetData();
    41 $DataDescrBordure = $DataSetBordure->GetDataDescription();
    42 $Data2 = $DataSet2->GetData();
    43 $DataDescr2 = $DataSet2->GetDataDescription();
    44 
    45 if (isset($link)) {
    46   $font = 9;
    47   $ticks = 2;
    48   $scale = 14;
    49   $size = 150;
    50 } else {
    51   $font = 12;
    52   $ticks = 1;
    53   if ($type =='total') {
    54     $scale = 14;
    55     $size = 300;
    56   } else if ($type == 'commission') {
    57     $scale = 7;
    58     $size = 185;  // 70+$scale/$scaletotal*($sizetotal-70)
    59   } else if ($type == 'hemicycle') {
    60     $scale = 12;
    61     $size = 267;
    62   }
    63 }
    64 
    65 $Test = new xsPChart(800,$size);
    66 $Test->setGraphArea(25+3*$font,3*$font,780,$size-10-2*$font);
    67 $Test->drawFilledRoundedRectangle(7,7,793,$size-7,5,240,240,240);
    68 $Test->drawRoundedRectangle(5,5,795,$size - 5,5,230,230,230);
    69 $Test->drawGraphArea(230,230,230,FALSE);
    70 $Test->setFixedScale(0,$scale,$scale/$ticks);
    71 $Test->xsSetFontProperties("tahoma.ttf",$font);
    72 $Test->drawScale($Data,$DataDescr,SCALE_NORMAL,50,50,50,TRUE,0,0,FALSE,1,TRUE);
    73 $Test->drawGrid(0,TRUE,0,0,0,100);
    74 $Test->setColorPalette(0,50,50,50);
    75 $Test->drawOverlayBarGraph($Data2,$DataDescr2,30,100);
    76 $fonction = 0;
    77 if (isset($fonctions)) {
    78   $total = array_sum($presences);
    79   if ($total != 0) {
    80     if ($type == 'total') {
    81       $totalfonctions = $fonctions['hemicycle']+$fonctions['commission'];
    82     } else {
    83       $totalfonctions = $fonctions[$type];
    84     }
    85     $fonction = (int)(4*$totalfonctions/$total);
    86   }
    87 }
    88 $Test->setColorPalette(0,255,35*$fonction,0);
    89 $Test->setColorPalette(1,255,255,0);
    90 $Test->setColorPalette(2,0,255,0);
    91 $Test->drawFilledLineGraph($Data,$DataDescr,78);
    92 if ($questions == 1) {
    93   $Test->setColorPalette(0,0,0,255);
    94   $Test->drawOverlayBarGraph($Data3,$DataDescr3,85,25);
    95 }
    96 $Test->setColorPalette(0,255,35*$fonction,0);
    97 $Test->setColorPalette(1,0,0,0);
    98 $Test->drawLineGraph($DataBordure,$DataDescrBordure);
    99 $Test->xsSetFontProperties("tahoma.ttf",$font + 3);
    100 $pos_titre = 240;
    101 if ($time == 'lastyear') {
    102   if (isset($mandat_clos)) {
    103     $pos_titre = 210;
    104     $duree = ' sa dernière année de mandat';
    105   } else $duree = 's 12 derniers mois';
     2if ($time === 'lastyear')
    1063  $shortduree = 'annee';
    107 } else {
    108   $duree = " la session ".preg_replace('/^(\d{4})/', '\\1-', $time);
    109   $shortduree = $time;
    110 }
    111 if ($type == 'total') {
    112   $Test->drawTitle($pos_titre,3 + 2*$font,"Participation globale au cours de".$duree." (hémicycle et commissions)",50,50,50,585);
     4else $shortduree = $time;
     5if ($type === 'total')
    1136  $titre = 'globale-'.$shortduree;
    114 } else {
     7else {
    1158  $titre = $type;
    116   if ($type == 'commission') $titre .= 's';
    117   $Test->drawTitle($pos_titre+30,3 + 2*$font,"Participation en ".$titre." au cours de".$duree,50,50,50,585);
     9  if ($type === 'commission') $titre .= 's';
    11810  $titre .= '-'.$shortduree;
    11911}
    120 $filename = 'participation-'.$titre.'-'.$parlementaire->slug.isset($link).'.png';
    121 $Test->xsRender($filename);
     12$PictureID = "Map_".rand(1,10000).".map"; ?>
    12213
    123 if (isset($link))
    124   echo link_to(image_tag('tmp/xspchart/'.$filename, 'alt="Participation '.$titre.' de '.$parlementaire->nom.'"'), '@parlementaire_plot?slug='.$parlementaire->slug.'&time=lastyear');
    125 else echo '<div class="par_session">'.image_tag('tmp/xspchart/'.$filename, 'alt="Participation '.$titre.' de '.$parlementaire->nom.'"');
    126 echo "<p><span style='background-color: rgb(255,";
    127 echo 35*$fonction.",0);'>&nbsp;</span> ";
    128 if ($type == 'commission') echo '&nbsp;Présences enregistrées&nbsp;&nbsp;&nbsp;'; else echo '&nbsp;Présences relevées&nbsp;&nbsp;&nbsp;';
     14<?php if ($link === 'true') echo '<a href="'.url_for('@parlementaire_plot?slug='.$parlementaire->slug.'&time=lastyear').'">';
     15else echo '<div class="par_session">'; ?>
     16<img id="graph<?php echo $PictureID; ?>" alt="Participation <?php echo $titre; ?> de <?php echo $parlementaire->nom; ?>" src="<?php echo url_for('@parlementaire_plot_graph?slug='.$parlementaire->slug.'&time='.$time.'&type='.$type.'&questions='.$questions.'&link='.$link.'&mapId='.$PictureID); ?>" OnMouseMove="getMousePosition(event);" OnMouseOut="nd();"/>
     17<?php if ($link === 'true') { ?>
     18<script> LoadImageMap("graph<?php echo $PictureID; ?>", "<?php echo url_for('@parlementaire_plot_graph?slug='.$parlementaire->slug.'&time='.$time.'&type='.$type.'&questions='.$questions.'&link='.$link.'&drawAction=map&mapId='.$PictureID); ?>"); </script>
     19<?php } ?>
     20
     21<?php if ($link === 'true') echo '</a>';
     22echo "<p><span style='background-color: rgb(255,0,0);'>&nbsp;</span> ";
     23if ($type === 'commission') echo '&nbsp;Présences enregistrées&nbsp;&nbsp;&nbsp;';
     24else echo '&nbsp;Présences relevées&nbsp;&nbsp;&nbsp;';
    12925echo "<span style='background-color: rgb(255,200,0);'>&nbsp;</span>&nbsp;Participations&nbsp;&nbsp;&nbsp;";
    13026echo "<span style='background-color: rgb(0,255,0);'>&nbsp;</span>&nbsp;Mots prononcés (x&nbsp;10&nbsp;000)&nbsp;&nbsp;&nbsp;";
    131 if ($questions == 1)
     27if ($questions === 'true' && $type != 'commission')
    13228    echo "<span style='background-color: rgb(0,0,255);'>&nbsp;</span>&nbsp;Questions orales&nbsp;&nbsp;&nbsp;";
    13329echo "<span style='background-color: rgb(150,150,150);'>&nbsp;</span>&nbsp;Vacances parlementaires";
    134 if (isset($link))
     30if ($link === 'true')
    13531  echo "&nbsp;&nbsp;&nbsp;&nbsp;".link_to('Explications', '@parlementaire_plot?slug='.$parlementaire->slug.'&time=lastyear#explications').'</p>';
    136   else echo '</p></div>'
     32else echo '</p>';
     33if ($link != 'true')
     34  echo '</div>';
    13735?>
Note: See TracChangeset for help on using the changeset viewer.