[ Index ]
 

Code source de eGroupWare 1.2.106-2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/projectmanager/inc/jpgraph-1.5.2/src/Examples/ -> impulsex3.php (source)

   1  <?php
   2  include  ("../jpgraph.php");
   3  include  ("../jpgraph_scatter.php");
   4  
   5  $numpoints=50;
   6  $k=0.05;
   7  
   8  // Create some data points
   9  for($i=0; $i<$numpoints; ++$i) {
  10      $datay[$i]=exp(-$k*$i)*cos(2*M_PI/10*$i);
  11  }
  12  
  13  function mycallback($l) {
  14      return sprintf("%02.2f",$l);
  15  }
  16  
  17  // Setup the basic parameters for the graph
  18  $graph = new Graph(400,200,"auto");
  19  $graph->SetScale("intlin");
  20  $graph->SetShadow();
  21  $graph->SetBox();
  22  $graph->title->Set("Impuls Example 3");
  23  $graph->title->SetFont(FF_FONT1,FS_BOLD);
  24  
  25  // Set format for labels
  26  $graph->yaxis->SetLabelFormatString("%-02.1f");
  27  $graph->yaxis->SetLabelFormatCallback("mycallback");
  28  
  29  // Set X-axis at the minimum value of Y-axis (default will be at 0)
  30  $graph->xaxis->SetPos("min");    // "min" will position the x-axis at the minimum value of the Y-axis
  31  
  32  // Extend the margin for the labels on the Y-axis and reverse the direction
  33  // of the ticks on the Y-axis
  34  $graph->yaxis->SetTickLabelMargin(12);
  35  $graph->xaxis->SetTickLabelMargin(6);
  36  $graph->yaxis->SetTickDirection(SIDE_LEFT);
  37  $graph->xaxis->SetTickDirection(SIDE_DOWN);
  38  
  39  // Create a new impuls type scatter plot
  40  $sp1 = new ScatterPlot($datay);
  41  $sp1->mark->SetType(MARK_SQUARE);
  42  $sp1->mark->SetFillColor("red");
  43  $sp1->SetImpuls();
  44  $sp1->SetColor("blue");
  45  $sp1->SetWeight(1);
  46  $sp1->mark->SetWidth(3);
  47  
  48  $graph->Add($sp1);
  49  
  50  $graph->Stroke();
  51  
  52  ?>


Généré le : Sun Feb 25 17:20:01 2007 par Balluche grâce à PHPXref 0.7