extranet/www/graphs/synthese_graph.php

39 lines
938 B
PHP
Raw Normal View History

2009-03-25 18:32:45 +00:00
<?php
2009-03-30 16:41:42 +00:00
require_once './lib/phpchartdir.php';
2009-03-25 18:32:45 +00:00
2009-03-26 11:44:14 +00:00
# The data for the line chart
2009-03-30 16:27:40 +00:00
$data = unserialize(urldecode($_REQUEST['data']));
2009-03-31 14:16:03 +00:00
$unite = isset($_REQUEST['unite']) ? $_REQUEST['unite'] : 'KEUROS';
2009-04-01 07:32:24 +00:00
$firephp->log($data,'data');
2009-03-30 16:27:40 +00:00
foreach($data as $value){
2009-04-01 07:32:24 +00:00
$dataX[] = $value['value'];
2009-03-31 14:16:03 +00:00
//$jour = substr($value['date'],6,2);
//$mois = substr($value['date'],4,2);
2009-04-01 07:32:24 +00:00
//$annee = substr($value['date'],0,4);
2009-03-31 14:16:03 +00:00
$labelsX[] = substr($value['date'],0,4);
2009-03-30 16:27:40 +00:00
}
2009-03-26 11:44:14 +00:00
2009-03-31 14:16:03 +00:00
$i=-100;
while($i>100){ $labelsY[] = $i;}
2009-03-26 11:44:14 +00:00
# Create a XYChart object of size 250 x 250 pixels
$c = new XYChart(350, 250);
$c->setPlotArea(50, 10, 280, 200);
2009-03-31 14:16:03 +00:00
$c->yAxis->setTitle($unite);
2009-03-26 11:44:14 +00:00
$c->xAxis->setTitle("Ann<EFBFBD>es");
$c->xAxis->setWidth(2);
$c->yAxis->setWidth(2);
2009-03-31 14:16:03 +00:00
$c->addLineLayer($dataX);
# Set the labels.
$c->yAxis->setLabels($labelsY);
$c->yAxis->setLabelStep(10);
$c->xAxis->setLabels($labelsX);
2009-03-26 11:44:14 +00:00
# Output the chart
header("Content-type: image/png");
print($c->makeChart2(PNG));
?>