[ Index ]
 

Code source de jpGraph 2.2

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/src/Examples/ -> linebarex3.php (source)

   1  <?php
   2  
   3  include  ("../jpgraph.php");
   4  include  ("../jpgraph_line.php");
   5  include  ("../jpgraph_bar.php");
   6  
   7  // Some data
   8  
   9  $steps=100;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->img->SetMargin(40,180,40,40);    
  21  $graph->SetBackgroundImage("tiger_bkg.png",BGIMG_FILLFRAME);
  22  
  23  //$graph->img->SetAntiAliasing();
  24  
  25  $graph->SetScale("intlin");
  26  $graph->SetShadow();
  27  $graph->title->Set("Combined bar and line plot");
  28  $graph->subtitle->Set("(\"center\" aligned bars)");
  29  
  30  // Use built in font
  31  $graph->title->SetFont(FF_FONT1,FS_BOLD);
  32  
  33  // Slightly adjust the legend from it's default position in the
  34  // top right corner. 
  35  $graph->legend->Pos(0.05,0.5,"right","center");
  36  
  37  // Create the first line
  38  
  39  $p1 = new LinePlot($datay,$datax);
  40  $p1->SetWeight(1);
  41  $p1->SetColor("red");
  42  $p1->SetLegend("Triumph Tiger -98");
  43  $graph->Add($p1);
  44  
  45  $b1 = new BarPlot($databary,$databarx);
  46  $b1->SetAbsWidth(10);
  47  $b1->SetAlign("center");
  48  $b1->SetShadow();
  49  $graph->Add($b1);
  50  
  51  $graph->Stroke();
  52  ?>


Généré le : Sat Nov 24 09:27:55 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics