Merge amélioration graphique stacked

This commit is contained in:
Michael RICOIS 2010-07-08 08:58:49 +00:00
commit 22344e96d2

View File

@ -8,13 +8,13 @@ function commentaires_siren($content){
}
function commentaires_liste($content){
$output = $content;
$output = $content;
$pattern = '/(.*?)<li([:|\=|\+|-]?)>(.*)/i';
$pattern_all = '/<li([:|\=|\+|-]?)>(.*)(?:<br\/>)/isU';
preg_match_all($pattern_all, $content, $listes);
if ( isset($listes[0]) && count($listes[0])>0 ){
FB::log($listes, 'listes');
foreach ( $listes[0] as $index => $elementR ){
$output = commentaires_liste_replace($elementR, $listes[2][$index],
$listes[1][$index], $output);
@ -188,7 +188,7 @@ function commentaires_graphique($content){
$type = '';
$typePattern = array(
'projection' => '/(R\[.*]#H,.*_Y#L)/',
'stacked' => '/(R\[.*]#HS,?){1,};(R\[.*]#HS,?){1,}/',
'stacked' => '/((R\[.*]#HS,?){1,};?){1,}/',
'histo' => '/(Rs?\[.*]#[H|L],?){1,}/',
'radar' => '/(R\[.*]#R,?){1,}/',
);
@ -258,10 +258,8 @@ function commentaires_graph_stacked($id, $titre, $strRatios) {
0xee82e2, /*violet*/
);
}
$ratios = explode(';', $strRatios);
$stackRatiosL = explode(',', $ratios[0]);
$stackRatiosR = explode(',', $ratios[1]);
//Tri des bilans
foreach ($bilansInfos as $key => $row) {
$bilansInfos[$key]['cle'] = $key;
$date[$key] = $row['dateCloture'];
@ -282,7 +280,7 @@ function commentaires_graph_stacked($id, $titre, $strRatios) {
$dateCloture = substr($bilansInfos[0]['dateCloture'],0,4);
//Génération du graphique
require_once('phpchartdir/phpchartdir.php');
require_once 'phpchartdir/phpchartdir.php';
$path = PATH_SITE.'/cache/imgcache/';
$file = $id.'.png';
$c = new XYChart(548, 300);
@ -296,40 +294,27 @@ function commentaires_graph_stacked($id, $titre, $strRatios) {
$layer->setBorderColor(Transparent, softLighting(Left));
$cpt_couleur = 0;
$pattern = '/(Rs?)\[(.*)]#.{1}/';
$layer->addDataGroup("Actif");
foreach($stackRatiosL as $ratio){
preg_match($pattern, $ratio, $matches);
$value = $ratiosEntrep[$index]['r'.$matches[2]];
$titre = htmlspecialchars_decode(
$ratiosInfos['r'.$matches[2]]['libelle'],ENT_QUOTES);
//FB::log($ratio, $titre);
//FB::log($value,'value');
$layer->addDataSet(array($value), $couleurs[$cpt_couleur], $titre);
$cpt_couleur++;
if($cpt_couleur>=count($couleurs)) { $cpt_couleur=0; }
$ratios = explode(';', $strRatios);
foreach ( $ratios as $indexGroup => $groupRatios ){
$stackRatios = explode(',', $groupRatios);
$layer->addDataGroup('Group'.$indexGroup);
foreach($stackRatios as $ratio){
preg_match($pattern, $ratio, $matches);
$value = $ratiosEntrep[$index]['r'.$matches[2]];
$titre = htmlspecialchars_decode(
$ratiosInfos['r'.$matches[2]]['libelle'],ENT_QUOTES);
//FB::log($ratio, $titre);
//FB::log($value,'value');
$layer->addDataSet(array($value), $couleurs[$cpt_couleur], $titre);
$cpt_couleur++;
if($cpt_couleur>=count($couleurs)) { $cpt_couleur=0; }
}
}
$layer->addDataGroup("Passif");
foreach($stackRatiosR as $ratio){
preg_match($pattern, $ratio, $matches);
$value = $ratiosEntrep[$index]['r'.$matches[2]];
$titre = htmlspecialchars_decode(
$ratiosInfos['r'.$matches[2]]['libelle'],ENT_QUOTES);
//FB::log($ratio, $titre);
//FB::log($value,'value');
$layer->addDataSet(array($value), $couleurs[$cpt_couleur], $titre);
$cpt_couleur++;
if($cpt_couleur>=count($couleurs)) { $cpt_couleur=0; }
}
$layer->setBarGap(0.2, 0);
$c->yAxis->setAutoScale(0.2);
if( $c->makeChart($path.$file) === true )
{
if ( $c->makeChart($path.$file) === true ){
$output = $file;
}
else
{
} else {
$output = false;
}
return $output;