[ Index ]
 

Code source de jpGraph 2.2

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

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

   1  <?php
   2  include  ("../jpgraph.php");
   3  include  ("../jpgraph_bar.php");
   4  
   5  // Some data
   6  $months=$gDateLocale->GetShortMonth();
   7  
   8  srand ((double) microtime() * 1000000);
   9  for( $i=0; $i<25; ++$i) {
  10      $databary[]=rand(1,50);
  11      $databarx[]=$months[$i%12];
  12  }
  13      
  14  // New graph with a drop shadow
  15  $graph = new Graph(300,200,'auto');
  16  $graph->SetShadow();
  17  
  18  // Use a "text" X-scale
  19  $graph->SetScale("textlin");
  20  
  21  // Specify X-labels
  22  $graph->xaxis->SetTickLabels($databarx);
  23  $graph->xaxis->SetTextLabelInterval(1);
  24  $graph->xaxis->SetTextTickInterval(3);
  25  
  26  // Set title and subtitle
  27  $graph->title->Set("Bar tutorial example 5");
  28  
  29  // Use built in font
  30  $graph->title->SetFont(FF_FONT1,FS_BOLD);
  31  
  32  // Create the bar plot
  33  $b1 = new BarPlot($databary);
  34  $b1->SetLegend("Temperature");
  35  $b1->SetWidth(0.4);
  36  
  37  // The order the plots are added determines who's ontop
  38  $graph->Add($b1);
  39  
  40  // Finally output the  image
  41  $graph->Stroke();
  42  
  43  ?>
  44  
  45  


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