<?php // content="text/plain; charset=utf-8" require_once 'jpgraph/jpgraph.php'; require_once 'jpgraph/jpgraph_line.php'; require_once 'jpgraph/jpgraph_utils.inc.php'; $f = new FuncGenerator('cos($i)', '$i*$i*$i'); list($xdata, $ydata) = $f->E(-M_PI, M_PI, 25); $graph = new Graph\Graph(350, 430); $graph->SetScale("linlin"); $graph->SetShadow(); $graph->img->SetMargin(50, 50, 60, 40); $graph->SetBox(true, 'black', 2); $graph->SetMarginColor('white'); $graph->SetColor('lightyellow'); $graph->SetAxisStyle(AXSTYLE_BOXIN); $graph->xgrid->Show(); //$graph->xaxis->SetLabelFormat('%.0f'); $graph->img->SetMargin(50, 50, 60, 40); $graph->title->Set("Function plot"); $graph->title->SetFont(FF_FONT1, FS_BOLD); $graph->subtitle->Set("(BOXIN Axis style)"); $graph->subtitle->SetFont(FF_FONT1, FS_NORMAL); $lp1 = new Plot\LinePlot($ydata, $xdata); $lp1->SetColor("blue"); $lp1->SetWeight(2); $graph->Add($lp1); $graph->Stroke();
<?php // content="text/plain; charset=utf-8" require_once 'jpgraph/jpgraph.php'; require_once 'jpgraph/jpgraph_scatter.php'; // Make a circle with a scatterplot $steps = 16; for ($i = 0; $i < $steps; ++$i) { $a = 2 * M_PI / $steps * $i; $datax[$i] = cos($a); $datay[$i] = sin($a); } $graph = new Graph\Graph(350, 230); $graph->SetScale('linlin'); $graph->SetShadow(); $graph->SetAxisStyle(AXSTYLE_BOXOUT); $graph->img->SetMargin(50, 50, 60, 40); $graph->title->Set('Linked scatter plot'); $graph->title->SetFont(FF_FONT1, FS_BOLD); $graph->subtitle->Set('(BOXOUT Axis style)'); $graph->subtitle->SetFont(FF_FONT1, FS_NORMAL); // 10% top and bottom grace $graph->yscale->SetGrace(5, 5); $graph->xscale->SetGrace(1, 1); $sp1 = new ScatterPlot($datay, $datax); $sp1->mark->SetType(MARK_FILLEDCIRCLE); $sp1->mark->SetFillColor('red'); $sp1->SetColor('blue'); $sp1->mark->SetWidth(4); $sp1->link->Show(); $sp1->link->SetStyle('dotted');
<?php // content="text/plain; charset=utf-8" require_once 'jpgraph/jpgraph.php'; require_once 'jpgraph/jpgraph_line.php'; require_once 'jpgraph/jpgraph_utils.inc.php'; $f = new FuncGenerator('cos($i)', '$i*$i*$i'); list($xdata, $ydata) = $f->E(-M_PI, M_PI, 25); $graph = new Graph\Graph(380, 450); $graph->SetScale("linlin"); $graph->SetShadow(); $graph->img->SetMargin(50, 50, 60, 40); $graph->SetBox(true, 'black', 2); $graph->SetMarginColor('white'); $graph->SetColor('lightyellow'); $graph->SetAxisStyle(AXSTYLE_SIMPLE); //$graph->xaxis->SetLabelFormat('%.1f'); $graph->title->Set("Function plot with marker"); $graph->title->SetFont(FF_FONT1, FS_BOLD); $graph->subtitle->Set("(BOXOUT Axis style)"); $graph->subtitle->SetFont(FF_FONT1, FS_NORMAL); $lp1 = new Plot\LinePlot($ydata, $xdata); $lp1->mark->SetType(MARK_FILLEDCIRCLE); $lp1->mark->SetFillColor("red"); $lp1->SetColor("blue"); $graph->Add($lp1); $graph->Stroke();