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 45 46 47 48 49 50 51 52 53
| <?php
require_once "Artichow/LinePlot.class.php";
$graph = new Graph(600, 300);
$graph->setAntiAliasing(TRUE);
$values = array(1, 7, 3, 2.5, 5, -4.5, -5, rand(0,7), rand(0,7), rand(0,7), rand(0,7), rand(0,7)); #valeur a afficher
$plot = new LinePlot($values);
$plot->setBackgroundColor(new Color(240, 240, 240));
$plot->hideLine(TRUE);
$plot->setFillColor(new Color(100, 180, 180, 75)); #couleur sous la courbe
$plot->grid->setBackgroundColor(new Color(235, 235, 180, 60));
$plot->yAxis->setLabelPrecision(2); #chiffre apres la virgule en ordonnée
$days = array(
'00h',
'01h',
'02h',
'03h',
'04h',
'06h',
'07h',
'08h',
'09h',
'10h',
'11h',
'12h'
);
$plot->xAxis->setLabelText($days);
$plot->setSpace(6, 6, 10, 10); #etirement du diagramme
$plot->label->set($values);
$plot->label->move(0, -23); #position des petit label ac la valeur
$plot->label->setBackgroundGradient(
new LinearGradient(
new Color(250, 250, 250, 10),
new Color(255, 200, 200, 30),
0
)
);
$plot->label->border->setColor(new Color(20, 20, 20, 20));
$plot->label->setPadding(3, 1, 1, 0);
$graph->add($plot);
$graph->draw();
?> |