From bf9c2048e4cbd4d79e5a2a395eeaf2bdb0201c83 Mon Sep 17 00:00:00 2001 From: Michael RICOIS Date: Mon, 28 Jun 2010 10:12:36 +0000 Subject: [PATCH] Ajout gestion des lignes dans les graphiques histogrammes --- includes/commentaires/commentaires.php | 34 ++++++++++++++++++++------ 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/includes/commentaires/commentaires.php b/includes/commentaires/commentaires.php index 09c462b90..052a87c6b 100644 --- a/includes/commentaires/commentaires.php +++ b/includes/commentaires/commentaires.php @@ -324,6 +324,7 @@ function commentaires_graph_histo($id, $titre, $strRatios){ $data['y'][] = array( 'titre' => $titreRatio, 'data' => commentaires_graph_y($typeRatio, $numRatio), + 'style' => $matches[3], ); } } @@ -367,26 +368,43 @@ function commentaires_graph_histo($id, $titre, $strRatios){ $labelsX[] = $annee; } - $layer = $c->addBarLayer2(Side); - $layer->setBorderColor(Transparent, softLighting(Left)); + //Application layer pour bar + $barLayer = $c->addBarLayer2(Side); + $barLayer->setBorderColor(Transparent, softLighting(Left)); + //Application layer pour line + $lineLayer = $c->addLineLayer2(Side); + $lineLayer->setBorderColor(Transparent, softLighting(Left)); + $lineLayer->setLineWidth(2); + FB::log($data,'histo-Data'); $i = 0; foreach($data['y'] as $ydata){ FB::log($couleurs[$i], 'Couleur'); - $layer->addDataSet($ydata['data'], $couleurs[$i], $ydata['titre']); + if ( $ydata['style'] == 'H' ){ + $barLayer->addDataSet($ydata['data'], $couleurs[$i], $ydata['titre']); + } else if ( $ydata['style'] == 'L' ){ + $lineLayer->addDataSet($ydata['data'], $couleurs[$i], $ydata['titre']); + } + $i++; } $c->xAxis->setLabels($labelsX); if( $c->makeChart($path.$file) === true ){ $output = $file; - } - else{ + } else { $output = false; } } return $output; } -function commentaires_graph_radar($id, $titre, $strRatios){ +function commentaires_graph_radar($id, $titre, $strRatios) { + global $graphCouleurs; + if(count($graphCouleurs)>0){ + $couleurs = $graphCouleurs; + } else { + $couleurs = array(0x9999ff); + } + FB::log($couleurs, 'RADAR-couleur'); $ratios = explode(',', $strRatios); $data = array(); $pattern = '/(Rs?)\[(.*)]#(.{1})/'; @@ -433,11 +451,11 @@ function commentaires_graph_radar($id, $titre, $strRatios){ } $c = new PolarChart(548, 480); $c->setPlotArea(270, 240, 150); - $c->addAreaLayer($gdata, 0x9999ff); + $c->addAreaLayer($gdata, $couleurs[0]); $c->angularAxis->setLabels($labels); if( $c->makeChart($path.$file) === true ){ $output = $file; - }else{ + } else { $output = false; } return $output;