[ Index ]
 

Code source de jpGraph 2.2

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

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

   1  <?php
   2  include  ("../jpgraph.php");
   3  include  ("../jpgraph_log.php");
   4  include  ("../jpgraph_line.php");
   5  
   6  $ydata = array(11,3,8,12,5,1,9,13,5,7);
   7  $y2data = array(354,200,265,99,111,91,198,225,293,251);
   8  
   9  // Create the graph. These two calls are always required
  10  $graph = new Graph(350,200,"auto");    
  11  $graph->SetScale("textlog");
  12  $graph->SetShadow();
  13  $graph->img->SetMargin(40,110,20,40);
  14  
  15  // Show the gridlines
  16  $graph->ygrid->Show(true,true);
  17  $graph->xgrid->Show(true,false);
  18  
  19  // Create the linear plot
  20  $lineplot=new LinePlot($ydata);
  21  $lineplot2=new LinePlot($y2data);
  22  
  23  // Add the plot to the graph
  24  $graph->Add($lineplot);
  25  
  26  $graph->title->Set("Example 8");
  27  $graph->xaxis->title->Set("X-title");
  28  $graph->yaxis->title->Set("Y-title");
  29  
  30  $graph->title->SetFont(FF_FONT1,FS_BOLD);
  31  $graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
  32  $graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
  33  
  34  $lineplot->SetColor("blue");
  35  $lineplot->SetWeight(2);
  36  
  37  // Adjust the color of the Y axis
  38  $graph->yaxis->SetColor("blue");
  39  
  40  // Specifya a legend
  41  $lineplot->SetLegend("Plot 1");
  42  
  43  // Adjust the position of the grid box
  44  $graph->legend->Pos(0.05,0.5,"right","center");
  45  
  46  // Display the graph
  47  $graph->Stroke();
  48  ?>


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