[ Index ]
 

Code source de jpGraph 2.2

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/src/Examples/ -> example16.3.php (source)

   1  <?php
   2  include  ("../jpgraph.php");
   3  include  ("../jpgraph_line.php");
   4  include  ("../jpgraph_bar.php");
   5  
   6  $l1datay = array(11,9,2,4,3,13,17);
   7  $l2datay = array(23,12,5,19,17,10,15);
   8  $datax=array("Jan","Feb","Mar","Apr","May");
   9  
  10  // Create the graph. 
  11  $graph = new Graph(400,200,"auto");    
  12  $graph->SetScale("textlin");
  13  
  14  $graph->img->SetMargin(40,130,20,40);
  15  $graph->SetShadow();
  16  
  17  // Create the linear error plot
  18  $l1plot=new LinePlot($l1datay);
  19  $l1plot->SetColor("red");
  20  $l1plot->SetWeight(2);
  21  $l1plot->SetLegend("Prediction");
  22  
  23  
  24  // Create the bar plot
  25  $bplot = new BarPlot($l2datay);
  26  $bplot->SetFillColor("orange");
  27  $bplot->SetLegend("Result");
  28  
  29  // Add the plots to t'he graph
  30  $graph->Add($bplot);
  31  $graph->Add($l1plot);
  32  
  33  
  34  $graph->title->Set("Adding a line plot to a bar graph v1");
  35  $graph->xaxis->title->Set("X-title");
  36  $graph->yaxis->title->Set("Y-title");
  37  
  38  $graph->title->SetFont(FF_FONT1,FS_BOLD);
  39  $graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
  40  $graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
  41  
  42  //$graph->xaxis->SetTickLabels($datax);
  43  //$graph->xaxis->SetTextTickInterval(2);
  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