extranet/www/pages/synthese_graph.php
2009-03-26 11:44:14 +00:00

38 lines
748 B
PHP

<?php
require_once '../graphs/lib/phpchartdir.php';
# The data for the line chart
$data = array(30, 28, 40, 55, 75);
# The labels for the line chart
$labelsX = array('2004','2005','2006','2007','2008',);
//@TODO : Spécifier le pourcentage min et max
for($i=0;$i<=100;$i++){
$labelsY[] = $i;
}
# Create a XYChart object of size 250 x 250 pixels
$c = new XYChart(280, 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($data);
# 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));
?>