Voici le code que j utilise
<?php function newLineGraph($cachefilename, $ydata, $xdata)
{
require_once ('src/jpgraph.php');
require_once ('src/jpgraph_line.php');
require_once ('src/jpgraph_utils.inc.php');
require_once ('src/jpgraph_date.php');
// First we create the graph with a size of 600 x 500.
$graph = new Graph(1000, 800);
// Check if the image already exists in the cache and is valid
$valid = $graph -> cache -> IsValid($cachefilename);
if ($valid)
{
// The cached file exists and has not expired, so we do not
// need to create a new one
return;
}
else
{
// The cache file does not exists or has expired, so we
// create the graph as normal
// Tell the graph that we want to cache this image
// with a timeout of 60
$graph -> SetupCache($cachefilename, 60);
//Set the scale to use DateScale
$graph -> SetScale("datlin");
//Set the text for the graph Title
$nom = $_GET['n_ident'];
$graph -> title -> Set("Courbe de croissance $nom");
//Enable clipping to prevent the line from extending
// outside of the plot area
$graph -> SetClipping(true);
// Set the date format to use for the date labels
$graph -> xaxis -> scale -> SetDateFormat('d-M-Y');
// inclinason date
$graph->xaxis->SetTickLabels($datax);
$graph->xaxis->SetLabelAngle(90);
// Since we're taking in dates from MySQL, we need to
// convert them to time
$graph->xaxis->title->Set("Date" );
$graph->yaxis->title->Set("Poids en grammes" );
$xDates = array ();
for ($i = 0; $i < sizeof($xdata); $i++)
{
$time = strtotime($xdata[$i]);
array_push($xDates, $time);
}
$dateUtils = new DateScaleUtils();
// We'll let getAutoTicks calculate all of the ticks between
// our min and max dates. We also set the max number of
// ticks to 5.'
$autoTicks = $dateUtils -> getAutoTicks($xDates[0],
$xDates[sizeof($xDates) - 1], 10);
// Se the tick positions to the ones returned by getAutoTicks
$graph -> xaxis -> SetTickPositions($autoTicks[1]);
// Now we create the actual plot line
$lineplot = new LinePlot($ydata, $xDates);
$lineplot -> SetLegend( 'courbe');
// Add the plot line to the graph
$graph -> Add($lineplot);
$graph->SetBackgroundImage("LOGO900NEON.png",BGIMG_FILLPLOT);
$graph->img->SetAntiAliasing("white");
// Get the filepath where the cache file will be saved
// NOTE: You MUST specify an absolute filepath here,
// for example '/myCacheFiles/filename' will not work
$absolutePath = (CACHE_DIR . "" . $cachefilename);
// And finally, set the filepath when we call the Stroke function
$graph -> Stroke($absolutePath);
}
}
//$ydata = array ( 11, 12, 11, 10, 10.5);
//$xdata = array ('2010-07-01', '2010-07-02', '2010-07-03','2010-07-04', '2010-07-09');
$filename = 'myFile.png';
$graph = newLineGraph($filename, $ydata, $xdata);
?>
Voici la page ou ce trouve la courbe avec le code ci dessus ==> http://www.repro-reptiles.com/reptiles/ ... dent=PG001