[ Index ]
 

Code source de jpGraph 2.2

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/src/Examples/ -> example8.1.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->SetY2Scale("log");
  13  
  14  $graph->SetShadow();
  15  $graph->SetMargin(40,110,20,40);
  16  
  17  $graph->ygrid->Show(true,true);
  18  $graph->xgrid->Show(true,false);
  19  
  20  // Create the linear plot
  21  $lineplot=new LinePlot($ydata);
  22  
  23  $lineplot2=new LinePlot($y2data);
  24  $lineplot2->SetColor("orange");
  25  $lineplot2->SetWeight(2);
  26  
  27  $graph->yaxis->scale->ticks->SupressFirst();
  28  
  29  // Add the plot to the graph
  30  $graph->Add($lineplot);
  31  $graph->AddY2($lineplot2);
  32  
  33  $graph->title->Set("Example 8");
  34  $graph->xaxis->title->Set("X-title");
  35  $graph->yaxis->title->Set("Y-title");
  36  
  37  $graph->title->SetFont(FF_FONT1,FS_BOLD);
  38  $graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
  39  $graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
  40  
  41  $lineplot->SetColor("blue");
  42  $lineplot->SetWeight(2);
  43  
  44  $lineplot2->SetColor("orange");
  45  $lineplot2->SetWeight(2);
  46  
  47  $graph->yaxis->SetColor("blue");
  48  $graph->y2axis->SetColor("orange");
  49  
  50  $lineplot->SetLegend("Plot 1");
  51  $lineplot2->SetLegend("Plot 2");
  52  
  53  $graph->legend->Pos(0.05,0.5,"right","center");
  54  
  55  // Display the graph
  56  $graph->Stroke();
  57  ?>


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