[ Index ]
 

Code source de jpGraph 2.2

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/src/Examples/ -> example6.2.php (source)

   1  <?php
   2  include  ("../jpgraph.php");
   3  include  ("../jpgraph_line.php");
   4  
   5  $ydata = array(11,3,8,12,5,1,9,13,5,7);
   6  $y2data = array(354,200,265,99,111,91,198,225,293,251);
   7  
   8  // Create the graph and specify the scale for both Y-axis
   9  $graph = new Graph(300,240,"auto");    
  10  $graph->SetScale("textlin");
  11  $graph->SetShadow();
  12  
  13  // Adjust the margin
  14  $graph->img->SetMargin(40,40,20,70);
  15  
  16  // Create the two linear plot
  17  $lineplot=new LinePlot($ydata);
  18  $lineplot->SetStepStyle();
  19  
  20  // Adjust the axis color
  21  $graph->yaxis->SetColor("blue");
  22  
  23  $graph->title->Set("Example 6.2");
  24  $graph->xaxis->title->Set("X-title");
  25  $graph->yaxis->title->Set("Y-title");
  26  
  27  $graph->title->SetFont(FF_FONT1,FS_BOLD);
  28  $graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
  29  $graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
  30  
  31  // Set the colors for the plots 
  32  $lineplot->SetColor("blue");
  33  $lineplot->SetWeight(2);
  34  
  35  // Set the legends for the plots
  36  $lineplot->SetLegend("Plot 1");
  37  
  38  // Add the plot to the graph
  39  $graph->Add($lineplot);
  40  
  41  // Adjust the legend position
  42  $graph->legend->SetLayout(LEGEND_HOR);
  43  $graph->legend->Pos(0.4,0.95,"center","bottom");
  44  
  45  // Display the graph
  46  $graph->Stroke();
  47  ?>


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