[42] | 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_error.php'); |
---|
| 5 | |
---|
| 6 | |
---|
| 7 | //$datax = array(3.5,3.7,3,4,6.2,6,3.5,8,14,8,11.1,13.7); |
---|
| 8 | $datay = array(1.23,1.9,1.6,3.1,3.4,2.8,2.1,1.9); |
---|
| 9 | $graph = new Graph(300,200); |
---|
| 10 | $graph->img->SetMargin(40,40,40,40); |
---|
| 11 | $graph->img->SetAntiAliasing(); |
---|
| 12 | $graph->SetScale("textlin"); |
---|
| 13 | $graph->SetShadow(); |
---|
| 14 | $graph->title->Set("Example of line centered plot"); |
---|
| 15 | $graph->title->SetFont(FF_FONT1,FS_BOLD); |
---|
| 16 | |
---|
| 17 | |
---|
| 18 | // Use 20% "grace" to get slightly larger scale then min/max of |
---|
| 19 | // data |
---|
| 20 | $graph->yscale->SetGrace(20); |
---|
| 21 | |
---|
| 22 | |
---|
| 23 | $p1 = new LinePlot($datay); |
---|
| 24 | $p1->mark->SetType(MARK_FILLEDCIRCLE); |
---|
| 25 | $p1->mark->SetFillColor("red"); |
---|
| 26 | $p1->mark->SetWidth(4); |
---|
| 27 | $p1->SetColor("blue"); |
---|
| 28 | $p1->SetCenter(); |
---|
| 29 | $graph->Add($p1); |
---|
| 30 | |
---|
| 31 | $graph->Stroke(); |
---|
| 32 | |
---|
| 33 | ?> |
---|
| 34 | |
---|
| 35 | |
---|