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
| # ------------------------------------------------------------------- Donnees d'entrée
$ValeurPrevues = array(4,8,12,17,19,33,40,42);
$NumeroSemaines = array('2015_s07','2015_s12','2015_s19','2015_s25','2015_s27','2015_s33','2015_s41','2015_s45');
# $NumeroSemaines = array('2015_s07','2015_s08','2015_s09','2015_s10','2015_s11','2015_s12','2015_s13','2015_s14');
# --------------------------------------------------------------------
$Titre = utf8_decode(" sur le projet '".strtoupper($NomProjet)."' dans l'usine '".strtoupper($CodeUsine)."' ");
$SousTitre = utf8_decode("PREVISIONS de l'indicateur '".$Indicateur."' pour le métier '".$Metier."' ");
$LegendePrevue = utf8_decode("Valeurs prévues");
require_once "jpgraph.php"; # Bibliothèque JPGRAPH
require_once "jpgraph_line.php"; # graphique LIGNE
require_once "jpgraph_date.php"; # Echelle de TEMPS
# ------------------------------------------------------------------- Fabrication de l'Image
$Graphe = new Graph(800,600,"auto"); # Setup the graph.
$Graphe->SetScale('textint'); # Echelle TEXTE en X et ENTIERE en Y
$Graphe->SetMargin(45,10,30,10); # marge du cadre ... Gauche, Droite, Haut, Bas
$Graphe->SetMarginColor('#12be7a'); # Couleur du cadre autour du graphe
$Graphe->SetShadow(); # Ongler
$Graphe->yaxis->scale->SetAutoMin(0); # yes !! pour caller l'origine à ZERO même si les valeurs commencent plus loin
$Graphe->legend->SetPos(0.1,0.5,'right','middle'); # Position de la légende
$Graphe->legend->SetColumns(1); # Sur N colonnes
# --------------------------------------------------------------- Affichage des Unités SEMAINE
$Graphe->xaxis->SetFont(FF_ARIAL,FS_NORMAL,10); # Setup font for axis
$Graphe->xaxis->SetTickLabels($NumeroSemaines); # Setup X-axis labels
$Graphe->xaxis->SetColor('black');
$Graphe->yaxis->SetFont(FF_ARIAL,FS_NORMAL,10);
$Graphe->yaxis->SetColor('darkgray');
# ------------------------------------------------------------------- Fabrication du Tracé des PREVISIONS
$Prevu = new LinePlot($ValeurPrevues); # Create the bar pot
$Prevu->SetLegend ($LegendePrevue);
$Prevu->value->Show(true);
$Prevu->SetColor ('blue');
$Graphe->Add($Prevu);
# ------------------------------------------------------------------- fabrication du fichier et affichage
$Fichier = DirTemporaire."/graphique.jpg";
$Graphe->Stroke($Fichier); # stocke le graphique dans le fichier |
Partager