nidosaur Hugh !^. | voila mon pti code
Code :
- <?php
- include("./admin/kevin.inc.php" );
- include("./admin/connec.php" );
- include "./jpgraph/jpgraph.php";
- include "./jpgraph/jpgraph_line.php";
- include "./jpgraph/jpgraph_regstat.php";
- // Original data points
- $graphresult = mysql_query ("-----" ) or die ("la requete a echouee" );
- $graphr = @mysql_fetch_array($graphresult);
- $chaine = $graphr[TOTO];
- $chaine = str_replace(",", ".", $chaine);
- $ydata = explode("|", $chaine);
- $xdata = array();
- for ($i=0;$i<=120;$i++)
- {
- array_push($xdata,"$i" );
- }
- // Get the interpolated values by creating
- // a new Spline object.
- $spline = new Spline($xdata,$ydata);
- // For the new data set we want 40 points to
- // get a smooth curve.
- list($newx,$newy) = $spline->Get(40);
- // Create the graph
- $g = new Graph(690,433,"auto" );
- $g->SetScale('linlin');
- $g->SetMargin(50,20,40,40);
- $g->SetMarginColor('white');
- $g->img->SetAntiAliasing();
- // We need a linlin scale since we provide both
- // x and y coordinates for the data points.
- $g->yaxis->SetLabelmargin(4);
- $g->yaxis->SetTitlemargin(35);
- $g->xaxis->SetLabelFormat('%1.0f');
- $g->yaxis->SetLabelFormat('%1.2f');
- $g->yaxis->scale->SetGrace(10,10 );
- $g->yaxis->SetTickSide(SIDE_LEFT);
- $g->xaxis->SetTickSide(SIDE_DOWN);
- // And a line plot to stroke the smooth curve we got
- // from the original control points
- $lplot = new LinePlot($newy,$newx);
- $lplot->SetColor('red');
- // Add the plots to the graph and stroke
- $g->Add($lplot);
- $g->Stroke();
- ?>
|
Le resultat
j aurais aimé avoir des arrondis sur les angles de la courbe, si qqn pouvait m aiguiller ?
thx Message édité par nidosaur le 17-09-2003 à 16:49:00
|