[ Index ]
 

Code source de jpGraph 2.2

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

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

   1  <?php
   2  include  ("../jpgraph.php");
   3  include  ("../jpgraph_line.php");
   4  include  ("../jpgraph_utils.inc.php");
   5  
   6  $f = new FuncGenerator('cos($x)*$x');
   7  list($xdata,$ydata) = $f->E(-1.2*M_PI,1.2*M_PI);
   8  
   9  $f = new FuncGenerator('$x*$x');
  10  list($x2data,$y2data) = $f->E(-2,2);
  11  
  12  // Setup the basic graph
  13  $graph = new Graph(450,350,"auto");
  14  $graph->SetScale("linlin");
  15  //$graph->SetShadow();
  16  $graph->img->SetMargin(5,10,60,9);    
  17  $graph->SetBox(true,'green',2);    
  18  $graph->SetMarginColor('black');
  19  $graph->SetColor('black');
  20  
  21  // ... and titles
  22  $graph->title->Set('Example of Function plot');
  23  $graph->title->SetFont(FF_FONT1,FS_BOLD);
  24  $graph->title->SetColor('lightgreen');
  25  $graph->subtitle->Set("(With some more advanced axis formatting\nHiding first and last label)");
  26  $graph->subtitle->SetFont(FF_FONT1,FS_NORMAL);
  27  $graph->subtitle->SetColor('lightgreen');
  28  
  29  $graph->xgrid->Show();
  30  $graph->xgrid->SetColor('darkgreen');
  31  $graph->ygrid->SetColor('darkgreen');
  32  
  33  $graph->yaxis->SetPos(0);
  34  $graph->yaxis->SetWeight(2);
  35  $graph->yaxis->HideZeroLabel();
  36  $graph->yaxis->SetFont(FF_FONT1,FS_BOLD);
  37  $graph->yaxis->SetColor('green','green');
  38  $graph->yaxis->HideTicks(true,true);
  39  $graph->yaxis->HideFirstLastLabel();
  40  
  41  $graph->xaxis->SetWeight(2);
  42  $graph->xaxis->HideZeroLabel();
  43  $graph->xaxis->HideFirstLastLabel();
  44  $graph->xaxis->SetFont(FF_FONT1,FS_BOLD);
  45  $graph->xaxis->SetColor('green','green');
  46  
  47  $lp1 = new LinePlot($ydata,$xdata);
  48  $lp1->SetColor('yellow');
  49  $lp1->SetWeight(2);
  50  
  51  $lp2 = new LinePlot($y2data,$x2data);
  52  list($xm,$ym)=$lp2->Max();
  53  $lp2->SetColor('blue');
  54  $lp2->SetWeight(2);
  55  
  56  
  57  $graph->Add($lp1);
  58  $graph->Add($lp2);
  59  $graph->Stroke();
  60  
  61  ?>
  62  
  63  


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