extranet/www/graphs/synthese_graph.php
Michael RICOIS dbb417888b
2009-03-30 16:41:42 +00:00

33 lines
760 B
PHP

<?php
require_once './lib/phpchartdir.php';
# The data for the line chart
$data = unserialize(urldecode($_REQUEST['data']));
foreach($data as $value){
$dataG[] = $value['value'];
$labelsX[] = substr($value['date'],0,4);
}
//@TODO : Spécifier le pourcentage min et max
$i=-100;
while($i>100){ $labelsY[] = $i;}
# Create a XYChart object of size 250 x 250 pixels
$c = new XYChart(300, 250);
$c->setPlotArea(40, 10, 200, 200);
$c->yAxis->setTitle("%");
$c->xAxis->setTitle("Années");
# Add a line chart layer using the given data
$c->addLineLayer($dataG);
# Set the labels.
$c->yAxis->setLabels($labelsY);
$c->yAxis->setLabelStep(10);
$c->xAxis->setLabels($labelsX);
# Output the chart
header("Content-type: image/png");
print($c->makeChart2(PNG));
?>