[ Index ] |
|
Code source de jpGraph 2.2 |
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 26 $graph->SetShadow(); 27 $graph->SetBox(); 28 $graph->title->Set("Impuls Example 4"); 29 $graph->title->SetFont(FF_FONT1,FS_BOLD); 30 31 // Set some other color then the boring default 32 $graph->SetColor("lightyellow"); 33 $graph->SetMarginColor("khaki"); 34 35 // Set legend box specification 36 $graph->legend->SetFillColor("white"); 37 $graph->legend->SetLineWeight(2); 38 39 // Set X-axis at the minimum value of Y-axis (default will be at 0) 40 $graph->xaxis->SetPos("min"); // "min" will position the x-axis at the minimum value of the Y-axis 41 42 // Extend the margin for the labels on the Y-axis and reverse the direction 43 // of the ticks on the Y-axis 44 $graph->yaxis->SetLabelMargin(12); 45 $graph->xaxis->SetLabelMargin(6); 46 $graph->yaxis->SetTickSide(SIDE_LEFT); 47 $graph->xaxis->SetTickSide(SIDE_DOWN); 48 49 // Add mark graph with static lines 50 $line = new PlotLine(HORIZONTAL,0,"black",2); 51 $graph->AddLine($line); 52 53 // Create a new impuls type scatter plot 54 $sp1 = new ScatterPlot($datay,$datax); 55 $sp1->mark->SetType(MARK_SQUARE); 56 $sp1->mark->SetFillColor("red"); 57 $sp1->mark->SetWidth(3); 58 59 $sp1->SetImpuls(); 60 $sp1->SetColor("blue"); 61 $sp1->SetWeight(1); 62 $sp1->SetLegend("Non-causal signal"); 63 64 $graph->Add($sp1); 65 66 // Create the envelope plot 67 $ep1 = new LinePlot($datayenv,$datax); 68 $ep1->SetStyle("dotted"); 69 $ep1->SetLegend("Positive envelope"); 70 71 $graph->Add($ep1); 72 73 $graph->Stroke(); 74 75 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sat Nov 24 09:27:55 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |