1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
<?
require_once "Artichow/BarPlot.class.php";
require_once "inc/connect.php";
$graph = new Graph(500, 500);
$graph->setAntiAliasing(TRUE);
$reponse = $bdd->query('select * from evolution');
while ($donnees = $reponse->fetch())
{
$xaxis[] = intval($donnees['Date']);
$xlibelle[] = $xaxis[] ;
$yaxis[] = intval($donnees['Prix']);
}
$reponse->closeCursor(); // Termine le traitement de la requête
$plot = new BarPlot($yaxis);
$plot->setSpace(6, 6, 10, 0);
$plot->setPadding(40, 15, 10, 40);
$plot->title->set("Prix des articles");
$plot->title->border->show();
$plot->title->setBackgroundColor(new Color(255, 255, 255, 25));
$plot->title->setPadding(4, 4, 4, 4);
$plot->title->move(-20, 25);
$plot->xAxis->title->set("Articles");
$plot->xAxis->title->setFont(new TuffyBold(10));
$plot->xAxis->setTitleAlignment(Label::RIGHT);
$plot->setBackgroundGradient(
new LinearGradient(
new Color(230, 230, 230),
new Color(255, 255, 255),
0
)
);
$y = $xlibelle;
$plot->xAxis->setLabelText($y);
$graph->add($plot);
$graph->draw();
?> |
Partager