Merge amélioration graphique stacked
This commit is contained in:
commit
22344e96d2
@ -188,7 +188,7 @@ function commentaires_graphique($content){
|
|||||||
$type = '';
|
$type = '';
|
||||||
$typePattern = array(
|
$typePattern = array(
|
||||||
'projection' => '/(R\[.*]#H,.*_Y#L)/',
|
'projection' => '/(R\[.*]#H,.*_Y#L)/',
|
||||||
'stacked' => '/(R\[.*]#HS,?){1,};(R\[.*]#HS,?){1,}/',
|
'stacked' => '/((R\[.*]#HS,?){1,};?){1,}/',
|
||||||
'histo' => '/(Rs?\[.*]#[H|L],?){1,}/',
|
'histo' => '/(Rs?\[.*]#[H|L],?){1,}/',
|
||||||
'radar' => '/(R\[.*]#R,?){1,}/',
|
'radar' => '/(R\[.*]#R,?){1,}/',
|
||||||
);
|
);
|
||||||
@ -258,10 +258,8 @@ function commentaires_graph_stacked($id, $titre, $strRatios) {
|
|||||||
0xee82e2, /*violet*/
|
0xee82e2, /*violet*/
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$ratios = explode(';', $strRatios);
|
|
||||||
$stackRatiosL = explode(',', $ratios[0]);
|
|
||||||
$stackRatiosR = explode(',', $ratios[1]);
|
|
||||||
|
|
||||||
|
//Tri des bilans
|
||||||
foreach ($bilansInfos as $key => $row) {
|
foreach ($bilansInfos as $key => $row) {
|
||||||
$bilansInfos[$key]['cle'] = $key;
|
$bilansInfos[$key]['cle'] = $key;
|
||||||
$date[$key] = $row['dateCloture'];
|
$date[$key] = $row['dateCloture'];
|
||||||
@ -282,7 +280,7 @@ function commentaires_graph_stacked($id, $titre, $strRatios) {
|
|||||||
$dateCloture = substr($bilansInfos[0]['dateCloture'],0,4);
|
$dateCloture = substr($bilansInfos[0]['dateCloture'],0,4);
|
||||||
|
|
||||||
//Génération du graphique
|
//Génération du graphique
|
||||||
require_once('phpchartdir/phpchartdir.php');
|
require_once 'phpchartdir/phpchartdir.php';
|
||||||
$path = PATH_SITE.'/cache/imgcache/';
|
$path = PATH_SITE.'/cache/imgcache/';
|
||||||
$file = $id.'.png';
|
$file = $id.'.png';
|
||||||
$c = new XYChart(548, 300);
|
$c = new XYChart(548, 300);
|
||||||
@ -296,40 +294,27 @@ function commentaires_graph_stacked($id, $titre, $strRatios) {
|
|||||||
$layer->setBorderColor(Transparent, softLighting(Left));
|
$layer->setBorderColor(Transparent, softLighting(Left));
|
||||||
$cpt_couleur = 0;
|
$cpt_couleur = 0;
|
||||||
$pattern = '/(Rs?)\[(.*)]#.{1}/';
|
$pattern = '/(Rs?)\[(.*)]#.{1}/';
|
||||||
$layer->addDataGroup("Actif");
|
$ratios = explode(';', $strRatios);
|
||||||
foreach($stackRatiosL as $ratio){
|
foreach ( $ratios as $indexGroup => $groupRatios ){
|
||||||
preg_match($pattern, $ratio, $matches);
|
$stackRatios = explode(',', $groupRatios);
|
||||||
$value = $ratiosEntrep[$index]['r'.$matches[2]];
|
$layer->addDataGroup('Group'.$indexGroup);
|
||||||
$titre = htmlspecialchars_decode(
|
foreach($stackRatios as $ratio){
|
||||||
$ratiosInfos['r'.$matches[2]]['libelle'],ENT_QUOTES);
|
preg_match($pattern, $ratio, $matches);
|
||||||
//FB::log($ratio, $titre);
|
$value = $ratiosEntrep[$index]['r'.$matches[2]];
|
||||||
//FB::log($value,'value');
|
$titre = htmlspecialchars_decode(
|
||||||
$layer->addDataSet(array($value), $couleurs[$cpt_couleur], $titre);
|
$ratiosInfos['r'.$matches[2]]['libelle'],ENT_QUOTES);
|
||||||
$cpt_couleur++;
|
//FB::log($ratio, $titre);
|
||||||
if($cpt_couleur>=count($couleurs)) { $cpt_couleur=0; }
|
//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);
|
$layer->setBarGap(0.2, 0);
|
||||||
$c->yAxis->setAutoScale(0.2);
|
$c->yAxis->setAutoScale(0.2);
|
||||||
|
if ( $c->makeChart($path.$file) === true ){
|
||||||
if( $c->makeChart($path.$file) === true )
|
|
||||||
{
|
|
||||||
$output = $file;
|
$output = $file;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$output = false;
|
$output = false;
|
||||||
}
|
}
|
||||||
return $output;
|
return $output;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user