Courbe php

Fermé
aisha91 - 28 juin 2013 à 15:47
mpmp93 Messages postés 6652 Date d'inscription mercredi 13 avril 2011 Statut Membre Dernière intervention 28 septembre 2015 - 30 janv. 2014 à 15:42
Bonjour,

j'ai créer un courbe avec jpgraph et il fonctionne bien voila le code :

<?php
include ("jpgraph.php");
include ("jpgraph_line.php");
//connexion au localhost et à la base de donnée
include ('cnx.php');
// de l'envoi des deux dates

// La requettes
$req = "select count(id),date_demande from educatelWP_demande_documentation group by date_demande";
$res=mysql_query($req);
$tableauElement = array();
$tableauNb = array(); //les modifs ici

while ($ligne=mysql_fetch_array($res))
{
$tableauElement[] = $ligne['count(id)'];
$tableauNb[] = $ligne['date_demande'];
}



// content="text/plain; charset=utf-8"



// Setup the graph
$graph = new Graph(920,400);
$graph->SetScale("textlin");

$theme_class=new UniversalTheme;

$graph->SetTheme($theme_class);
$graph->img->SetAntiAliasing(false);
$graph->title->Set(' ');
$graph->SetBox(false);

$graph->img->SetAntiAliasing();

$graph->yaxis->HideZeroLabel();
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false,false);

$graph->xgrid->Show();
$graph->xgrid->SetLineStyle("solid");
$graph->xaxis->SetTickLabels($tableauNb); //les modifs ici aussi
$graph->xgrid->SetColor('#E3E3E3');

// Create the line
$p1 = new LinePlot($tableauElement);
$graph->Add($p1);
$p1->SetColor("#6495ED");
$p1->SetLegend('Avancement Demande documentation');



$graph->legend->SetFrameWeight(1);
$graph->img->SetImgFormat('png');

$graph->Stroke("courbe.png"); // ici pour definir l'image de sortie
// Output line
echo ('<img src="courbe.png">'); // afficher l'image
?>


mais le probléme qui je veux afficher 2 graphique dans une page et ça fonctionne pas ,, n'hésitez pas à me répondre SVP

A voir également:

1 réponse

mpmp93 Messages postés 6652 Date d'inscription mercredi 13 avril 2011 Statut Membre Dernière intervention 28 septembre 2015 1 339
30 janv. 2014 à 15:42
Bonjour,

je n'utilise plus JPGRAPH mais RGRAPH:
https://html5.immo-scope.com/article/rgraph_debuter

plus simple...

A+
0