/usr/share/doc/libphp-jpgraph-examples/examples/impulsex3.php is in libphp-jpgraph-examples 1.5.2-12.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | <?php
include ("/usr/share/jpgraph/jpgraph.php");
include ("/usr/share/jpgraph/jpgraph_scatter.php");
$numpoints=50;
$k=0.05;
// Create some data points
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);
}
// Setup the basic parameters for the graph
$graph = new Graph(400,200,"auto");
$graph->SetScale("intlin");
$graph->SetShadow();
$graph->SetBox();
$graph->title->Set("Impuls Example 3");
$graph->title->SetFont(FF_FONT1,FS_BOLD);
// Set format for labels
$graph->yaxis->SetLabelFormatString("%-02.1f");
$graph->yaxis->SetLabelFormatCallback("mycallback");
// Set X-axis at the minimum value of Y-axis (default will be at 0)
$graph->xaxis->SetPos("min"); // "min" will position the x-axis at the minimum value of the Y-axis
// Extend the margin for the labels on the Y-axis and reverse the direction
// of the ticks on the Y-axis
$graph->yaxis->SetTickLabelMargin(12);
$graph->xaxis->SetTickLabelMargin(6);
$graph->yaxis->SetTickDirection(SIDE_LEFT);
$graph->xaxis->SetTickDirection(SIDE_DOWN);
// Create a new impuls type scatter plot
$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();
?>
|