[ 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/ -> impulsex4.php (source)

   1  <?php
   2  include  ("../jpgraph.php");
   3  include  ("../jpgraph_scatter.php");
   4  include  ("../jpgraph_line.php");
   5  
   6  $numpoints=50;
   7  $k=0.05;
   8  
   9  // Create some data points
  10  for($i=-$numpoints+1; $i<0; ++$i) {
  11      $datay[$i+$numpoints-1]=exp($k*$i)*cos(2*M_PI/10*$i)*14;
  12      $datayenv[$i+$numpoints-1]=exp($k*$i)*14;
  13      $datax[$i+$numpoints-1]=$i;
  14  }
  15  
  16  for($i=0; $i<$numpoints; ++$i) {
  17      $datay[$i+$numpoints-1]=exp(-$k*$i)*cos(2*M_PI/10*$i)*14;
  18      $datayenv[$i+$numpoints-1]=exp(-$k*$i)*14;
  19      $datax[$i+$numpoints-1]=$i;
  20  }
  21  
  22  // Setup the basic parameters for the graph
  23  $graph = new Graph(500,250,"auto");
  24  $graph->SetScale("intlin");
  25  $graph->SetShadow();
  26  $graph->SetBox();
  27  $graph->title->Set("Impuls Example 4");
  28  $graph->title->SetFont(FF_FONT1,FS_BOLD);
  29  
  30  // Set some other color then the boring default
  31  $graph->SetColor("lightyellow");
  32  $graph->SetMarginColor("khaki");
  33  
  34  // Set legend box specification
  35  $graph->legend->SetFillColor("white");
  36  $graph->legend->SetLineWeight(2);
  37  
  38  // Set X-axis at the minimum value of Y-axis (default will be at 0)
  39  $graph->xaxis->SetPos("min");    // "min" will position the x-axis at the minimum value of the Y-axis
  40  
  41  // Extend the margin for the labels on the Y-axis and reverse the direction
  42  // of the ticks on the Y-axis
  43  $graph->yaxis->SetTickLabelMargin(12);
  44  $graph->xaxis->SetTickLabelMargin(6);
  45  $graph->yaxis->SetTickDirection(SIDE_LEFT);
  46  $graph->xaxis->SetTickDirection(SIDE_DOWN);
  47  
  48  // Add mark graph with static lines
  49  $line = new PlotLine(HORIZONTAL,0,"black",2);
  50  $graph->AddLine($line);
  51  
  52  // Create a new impuls type scatter plot
  53  $sp1 = new ScatterPlot($datay,$datax);
  54  $sp1->mark->SetType(MARK_SQUARE);
  55  $sp1->mark->SetFillColor("red");
  56  $sp1->SetImpuls();
  57  $sp1->SetColor("blue");
  58  $sp1->SetWeight(1);
  59  $sp1->mark->SetWidth(3);
  60  $sp1->SetLegend("Non-causal signal");
  61  $graph->Add($sp1);
  62  
  63  
  64  // Create the envelope plot
  65  $ep1 = new LinePlot($datayenv,$datax);
  66  $ep1->SetStyle("dotted");
  67  $ep1->SetLegend("Positive envelope");
  68  $graph->Add($ep1);
  69  
  70  $graph->Stroke();
  71  
  72  ?>


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