72 lines
3.0 KiB
PHP
72 lines
3.0 KiB
PHP
|
<?php
|
|||
|
# Create a XYChart object of size 500 x 270 pixels, with a pale blue (e0e0ff)
|
|||
|
# background, black border, 1 pixel 3D border effect and rounded corners
|
|||
|
$c = new XYChart(570, 400, 0xcccccc, 0x000000, 1);
|
|||
|
$c->addText(60, 360, "* Elements financier rapport<72>s <20> 12 mois" );
|
|||
|
$c->setPlotArea(60, 110, 500, 200, 0xffffff, -1, -1, 0xcccccc, 0xcccccc);
|
|||
|
$c->yAxis->setTitle("K Euros","timesbi.ttf",10);
|
|||
|
$c->xAxis->setTitle( "<*block,valign=absmiddle*>Ann<6E>es<*/*>");
|
|||
|
$c->xAxis->setWidth(2);
|
|||
|
$c->yAxis->setWidth(2);
|
|||
|
|
|||
|
# Add a legend box at (55, 32) (top of the chart) with horizontal layout. Use 9 pts
|
|||
|
# Arial Bold font. Set the background and border color to Transparent.
|
|||
|
$legendObj = $c->addLegend(55, 30, false, "arial.ttf", 9);
|
|||
|
$legendObj->setBackground(Transparent);
|
|||
|
|
|||
|
# Add a title box to the chart using 15 pts Times Bold Italic font. The text is white
|
|||
|
# (ffffff) on a deep blue (000088) background, with soft lighting effect from the
|
|||
|
# right side.
|
|||
|
$textBoxObj = $c->addTitle("Synth<EFBFBD>se Perso", "arial.ttf", 15, 0x606060);
|
|||
|
$textBoxObj->setBackground(0xdddddd, -1, softLighting(Right));
|
|||
|
|
|||
|
# Set the y axis label format to display a percentage sign
|
|||
|
$c->yAxis->setLabelFormat("{value}");
|
|||
|
|
|||
|
$cnt = $_SESSION['graphperso']->cnt;
|
|||
|
|
|||
|
$ValueHex = array('DashLine' => 0x00000505
|
|||
|
, 'DotLine' => 0x00000202
|
|||
|
, 'DotDashLine' => 0x05050205
|
|||
|
, 'AltDashLine' => 0x0A050505);
|
|||
|
|
|||
|
for($i=0; $i<$cnt; $i++) {
|
|||
|
|
|||
|
$libelles = array_values($_SESSION['graphperso']->libelles);
|
|||
|
$datecloture = array_values($_SESSION['graphperso']->annees);
|
|||
|
$durees = array_values($_SESSION['graphperso']->durees);
|
|||
|
$chiffre = array_values($_SESSION['graphperso']->chiffres);
|
|||
|
$colors = array_values($_SESSION['graphperso']->colors);
|
|||
|
$styles = array_values($_SESSION['graphperso']->styles);
|
|||
|
|
|||
|
list($j0, $m0, $y0) = explode('/', $datecloture[$i][0]);
|
|||
|
list($j1, $m1, $y1) = explode('/', $datecloture[$i][1]);
|
|||
|
list($j2, $m2, $y2) = explode('/', $datecloture[$i][2]);
|
|||
|
|
|||
|
$dateDebut0 = date("d/m/Y", mktime(0, 0, 0, $m0-$durees[$i][0], $j0, $y0));
|
|||
|
$dateDebut1 = date("d/m/Y", mktime(0, 0, 0, $m1-$durees[$i][0], $j1, $y1));
|
|||
|
$dateDebut2 = date("d/m/Y", mktime(0, 0, 0, $m2-$durees[$i][0], $j2, $y2));
|
|||
|
|
|||
|
list($j0, $m0, $y0) = explode('/', $dateDebut0);
|
|||
|
list($j1, $m1, $y1) = explode('/', $dateDebut1);
|
|||
|
list($j2, $m2, $y2) = explode('/', $dateDebut2);
|
|||
|
|
|||
|
# The data for the chart
|
|||
|
${'dataY'.$i} = array($chiffre[$i][0], $chiffre[$i][1], $chiffre[$i][2]);
|
|||
|
${'dataX'.$i} = array(chartTime($y0, $m0, $j0), chartTime($y1, $m1, $j1), chartTime($y2, $m2, $j2));
|
|||
|
|
|||
|
# Add a red (ff0000) step line layer to the chart and set the line width to 2 pixels
|
|||
|
if($styles[$i] == 'Line') {
|
|||
|
|
|||
|
${'layer'.$i} = $c->addStepLineLayer(${'dataY'.$i}, $TabColor[$colors[$i]], $libelles[$i]);
|
|||
|
}
|
|||
|
else {
|
|||
|
|
|||
|
${'layer'.$i} = $c->addStepLineLayer(${'dataY'.$i}, $c->DashLineColor($TabColor[$colors[$i]], $ValueHex[$styles[$i]]), $libelles[$i]);
|
|||
|
}
|
|||
|
|
|||
|
${'layer'.$i}->setXData(${'dataX'.$i});
|
|||
|
${'layer'.$i}->setLineWidth(2);
|
|||
|
|
|||
|
}
|
|||
|
?>
|