[ Index ] |
|
Code source de jpGraph 2.2 |
1 <?php 2 include ("../jpgraph.php"); 3 include ("../jpgraph_line.php"); 4 include ("../jpgraph_bar.php"); 5 6 // Some data 7 8 $steps=100; 9 for($i=0; $i<$steps; ++$i) { 10 $datay[$i]=log(pow($i,$i/10)+1)*sin($i/15)+35; 11 $datax[]=$i; 12 if( $i % 10 == 0 ) { 13 $databarx[]=$i; 14 $databary[]=$datay[$i]/2; 15 } 16 } 17 18 // New graph with a background image and drop shadow 19 $graph = new Graph(450,300,"auto"); 20 $graph->SetBackgroundImage("tiger_bkg.png",BGIMG_FILLFRAME); 21 $graph->SetShadow(); 22 23 // Use an integer X-scale 24 $graph->SetScale("intlin"); 25 26 // Set title and subtitle 27 $graph->title->Set("Combined bar and line plot"); 28 $graph->subtitle->Set("(\"left\" aligned bars)"); 29 30 // Use built in font 31 $graph->title->SetFont(FF_FONT1,FS_BOLD); 32 33 // Make the margin around the plot a little bit bigger 34 // then default 35 $graph->img->SetMargin(40,120,40,40); 36 37 // Slightly adjust the legend from it's default position in the 38 // top right corner to middle right side 39 $graph->legend->Pos(0.05,0.5,"right","center"); 40 41 // Create a red line plot 42 $p1 = new LinePlot($datay,$datax); 43 $p1->SetColor("red"); 44 $p1->SetLegend("Status one"); 45 $graph->Add($p1); 46 47 // Create the bar plot 48 $b1 = new BarPlot($databary,$databarx); 49 $b1->SetLegend("Status two"); 50 $b1->SetAlign("left"); 51 $b1->SetShadow(); 52 $graph->Add($b1); 53 54 // Finally output the image 55 $graph->Stroke(); 56 57 ?> 58 59
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sat Nov 24 09:27:55 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |