2009-04-10 16:20:27 +00:00
|
|
|
|
<?php
|
|
|
|
|
require_once './lib/phpchartdir.php';
|
|
|
|
|
|
|
|
|
|
# The data for the line chart
|
|
|
|
|
$data = unserialize(urldecode($_REQUEST['data']));
|
|
|
|
|
$firephp->log($data,'data');
|
|
|
|
|
foreach($data['data'] as $value){
|
|
|
|
|
$dataX1[] = $value['entreprise'];
|
|
|
|
|
$dataX2[] = $value['secteur'];
|
|
|
|
|
$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(50, 10, 280, 200);
|
|
|
|
|
$c->yAxis->setTitle($data['unite']);
|
|
|
|
|
$c->xAxis->setTitle("Ann<EFBFBD>es");
|
|
|
|
|
$c->xAxis->setWidth(2);
|
|
|
|
|
$c->yAxis->setWidth(2);
|
|
|
|
|
|
|
|
|
|
$legendObj = $c->addLegend(50, 10, false, "times.ttf", 9);
|
|
|
|
|
$legendObj->setBackground(Transparent);
|
|
|
|
|
|
|
|
|
|
$c->addLineLayer($dataX1, 0x0000ff, "Entreprise");
|
2009-04-16 16:28:46 +00:00
|
|
|
|
$c->addLineLayer($dataX2, 0x008C00, "Secteur");
|
2009-04-10 16:20:27 +00:00
|
|
|
|
|
|
|
|
|
# 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));
|
|
|
|
|
|
|
|
|
|
?>
|