39 lines
932 B
PHP
39 lines
932 B
PHP
<?php
|
|
require_once './lib/phpchartdir.php';
|
|
|
|
# The data for the line chart
|
|
$data = unserialize(urldecode($_REQUEST['data']));
|
|
$unite = isset($_REQUEST['unite']) ? $_REQUEST['unite'] : 'KEUROS';
|
|
$firephp->log($data,'data');
|
|
foreach($data as $value){
|
|
$dataX[] = $value['value'];
|
|
//$jour = substr($value['date'],6,2);
|
|
//$mois = substr($value['date'],4,2);
|
|
//$annee = substr($value['date'],0,4);
|
|
$labelsX[] = substr($value['date'],0,4);
|
|
}
|
|
|
|
$i=-100;
|
|
while($i>100){ $labelsY[] = $i;}
|
|
|
|
# Create a XYChart object of size 250 x 250 pixels
|
|
$c = new XYChart(350, 250);
|
|
|
|
$c->setPlotArea(55, 10, 280, 200);
|
|
$c->yAxis->setTitle($unite);
|
|
$c->xAxis->setTitle("Années");
|
|
$c->xAxis->setWidth(2);
|
|
$c->yAxis->setWidth(2);
|
|
|
|
$c->addLineLayer($dataX);
|
|
# 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));
|
|
|
|
?>
|