[ Index ]
 

Code source de jpGraph 2.2

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

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

   1  <?php
   2  include  ("../jpgraph.php");
   3  include  ("../jpgraph_log.php");
   4  include  ("../jpgraph_line.php");
   5  
   6  
   7  $ydata = array(11,3,8,12,5,1,9,13,5,7);
   8  $y2data = array(354,200,265,99,111,91,198,225,293,251);
   9  $datax = array("Jan","Feb","Mar","Apr","Maj","Jun","Jul","aug","Sep","Oct");
  10  
  11  // Create the graph. These two calls are always required

  12  // We also specify a 2 min timeout for the cached image

  13  $graph = new Graph(350,200,"auto");
  14  $graph->SetScale("textlog");
  15  
  16  $graph->img->SetMargin(40,110,20,40);
  17  
  18  $graph->SetY2Scale("log");
  19  $graph->SetShadow();
  20  
  21  $graph->ygrid->Show(true,true);
  22  $graph->xgrid->Show(true,false);
  23  
  24  // Create the linear plot

  25  $lineplot=new LinePlot($ydata);
  26  $lineplot2=new LinePlot($y2data);
  27  
  28  $graph->yaxis->scale->ticks->SupressFirst();
  29  $graph->y2axis->scale->ticks->SupressFirst();
  30  // Add the plot to the graph

  31  $graph->Add($lineplot);
  32  $graph->AddY2($lineplot2);
  33  $lineplot2->SetColor("orange");
  34  $lineplot2->SetWeight(2);
  35  $graph->y2axis->SetColor("orange");
  36  
  37  $graph->title->Set("Examples 9");
  38  $graph->xaxis->title->Set("X-title");
  39  $graph->yaxis->title->Set("Y-title");
  40  
  41  $graph->title->SetFont(FF_FONT1,FS_BOLD);
  42  $graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
  43  $graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
  44  
  45  $lineplot->SetColor("blue");
  46  $lineplot->SetWeight(2);
  47  
  48  $lineplot2->SetColor("orange");
  49  $lineplot2->SetWeight(2);
  50  
  51  $graph->yaxis->SetColor("blue");
  52  
  53  $lineplot->SetLegend("Plot 1");
  54  $lineplot2->SetLegend("Plot 2");
  55  
  56  $graph->legend->Pos(0.05,0.5,"right","center");
  57  
  58  $graph->xaxis->SetTickLabels($datax);
  59  $graph->xaxis->SetTextTickInterval(2);
  60  
  61  // Display the graph

  62  $graph->Stroke();
  63  ?>


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