Files
le-matelot/client/plugins/statsplus/graphs/graph_3mois.php
2020-01-27 08:56:08 +01:00

64 lines
1.8 KiB
PHP

<?php
include_once(realpath(dirname(__FILE__)) . "/../../../../fonctions/authplugins.php");
autorisation("statsplus");
?>
<?php
include_once(realpath(dirname(__FILE__)) . "/../../../../classes/Commande.class.php");
include_once(realpath(dirname(__FILE__)) . "/../../../../classes/Venteprod.class.php");
include_once(realpath(dirname(__FILE__)) . "/../calc/calc_3mois.php");
$mois = date("m");
$annee = date("Y");
$values = array();
$days = array();
$ts = $_REQUEST['ts'];
for($i=0;$i<13;$i++){
$moisorig = date("m", $ts);
$values[] = calc(date("m", $ts), date("Y", $ts), 100, 1);
$days[] = trouve_mois(date("m", $ts)) . " " . date("Y", $ts);
while(date("m", $ts) == $moisorig) $ts +=1000;
}
include_once(realpath(dirname(__FILE__)) . "/../../../../lib/artichow/LinePlot.class.php");
$graph = new archiGraph(968, 200);
$graph->border->hide();
$graph->title = new archiLabel("Progression du chiffre d'Affaires sur 12 mois.",new archiFileFont(ARTICHOW_FONT.'/Arial', 10));
$plot = new archiLinePlot($values);
// $plot->setBackgroundColor(new archiColor(240, 240, 240));
$plot->hideLine(TRUE);
$plot->setFillColor(new archiColor(180, 180, 180, 75));
//$plot->grid->setBackgroundColor(new archiColor(235, 235, 180, 60));
$plot->grid->hideVertical();
$plot->yAxis->setLabelPrecision(2);
$plot->xAxis->setLabelText($days);
$plot->mark->setType(archiMark::IMAGE);
$plot->mark->setImage(new archiFileImage("../gfx/point_graph.png"));
$plot->label->set($values);
$plot->label->setColor(new archiColor(236, 128, 0));
$plot->label->move(0, -12);
$plot->label->setFont(new archiFileFont(ARTICHOW_FONT.'/Arial', 8));
$plot->label->setPadding(3, 1, 1, 0);
$plot->setSpace(2, 2, NULL, NULL);
$graph->add($plot);
$graph->draw();
?>