1 | <?php // content="text/plain; charset=utf-8" |
---|
2 | require_once ('jpgraph/jpgraph.php'); |
---|
3 | require_once ('jpgraph/jpgraph_line.php'); |
---|
4 | require_once ('jpgraph/jpgraph_utils.inc.php'); |
---|
5 | |
---|
6 | $f = new FuncGenerator('cos($i)','$i*$i*$i'); |
---|
7 | list($xdata,$ydata) = $f->E(-M_PI,M_PI,25); |
---|
8 | |
---|
9 | $graph = new Graph(350,430); |
---|
10 | $graph->SetScale("linlin"); |
---|
11 | $graph->SetShadow(); |
---|
12 | $graph->img->SetMargin(50,50,60,40); |
---|
13 | $graph->SetBox(true,'black',2); |
---|
14 | $graph->SetMarginColor('white'); |
---|
15 | $graph->SetColor('lightyellow'); |
---|
16 | $graph->SetAxisStyle(AXSTYLE_BOXIN); |
---|
17 | $graph->xgrid->Show(); |
---|
18 | |
---|
19 | |
---|
20 | //$graph->xaxis->SetLabelFormat('%.0f'); |
---|
21 | |
---|
22 | $graph->img->SetMargin(50,50,60,40); |
---|
23 | |
---|
24 | $graph->title->Set("Function plot"); |
---|
25 | $graph->title->SetFont(FF_FONT1,FS_BOLD); |
---|
26 | $graph->subtitle->Set("(BOXIN Axis style)"); |
---|
27 | $graph->subtitle->SetFont(FF_FONT1,FS_NORMAL); |
---|
28 | |
---|
29 | $lp1 = new LinePlot($ydata,$xdata); |
---|
30 | $lp1->SetColor("blue"); |
---|
31 | $lp1->SetWeight(2); |
---|
32 | |
---|
33 | $graph->Add($lp1); |
---|
34 | $graph->Stroke(); |
---|
35 | ?> |
---|
36 | |
---|
37 | |
---|