<?php
require_once ('jpgraph/jpgraph.php');
require_once ('jpgraph/jpgraph_scatter.php');
$numpoints=50;
$k=0.05;
for($i=0; $i<$numpoints; ++$i) {
$datay[$i]=exp(-$k*$i)*cos(2*M_PI/10*$i);
}
function mycallback($l) {
return sprintf("%02.2f",$l);
}
$graph = new Graph(400,200);
$graph->SetScale("intlin");
$graph->SetShadow();
$graph->SetBox();
$graph->title->Set("Impuls Example 3");
$graph->title->SetFont(FF_FONT1,FS_BOLD);
$graph->yaxis->SetLabelFormatCallback("mycallback");
$graph->xaxis->SetPos("min");
$graph->yaxis->SetLabelMargin(12);
$graph->xaxis->SetLabelMargin(6);
$graph->yaxis->SetTickSide(SIDE_LEFT);
$graph->xaxis->SetTickSide(SIDE_DOWN);
$sp1 = new ScatterPlot($datay);
$sp1->mark->SetType(MARK_SQUARE);
$sp1->mark->SetFillColor("red");
$sp1->SetImpuls();
$sp1->SetColor("blue");
$sp1->SetWeight(1);
$sp1->mark->SetWidth(3);
$graph->Add($sp1);
$graph->Stroke();
?> |