1 | <?php // content="text/plain; charset=utf-8" |
---|
2 | require_once ('jpgraph/jpgraph.php'); |
---|
3 | require_once ('jpgraph/jpgraph_scatter.php'); |
---|
4 | |
---|
5 | $datax = array(3.5,3.7,3,4,6.2,6,3.5,8,14,8,11.1,13.7); |
---|
6 | $datay = array(20,22,12,13,17,20,16,19,30,31,40,43); |
---|
7 | |
---|
8 | $graph = new Graph(300,200); |
---|
9 | $graph->SetScale("linlin"); |
---|
10 | |
---|
11 | $graph->Set90AndMargin(40,40,40,40); |
---|
12 | $graph->SetShadow(); |
---|
13 | |
---|
14 | $graph->title->Set("A 90 degrees rotated scatter plot"); |
---|
15 | $graph->title->SetFont(FF_FONT1,FS_BOLD); |
---|
16 | |
---|
17 | // Adjust the label align for X-axis so they look good rotated |
---|
18 | $graph->xaxis->SetLabelAlign('right','center','right'); |
---|
19 | |
---|
20 | // Adjust the label align for Y-axis so they look good rotated |
---|
21 | $graph->yaxis->SetLabelAlign('center','bottom'); |
---|
22 | |
---|
23 | $graph->xaxis->SetTitle('X-Axis title','low'); |
---|
24 | $graph->xaxis->title->SetAngle(90); |
---|
25 | $graph->xaxis->title->SetMargin(15); |
---|
26 | |
---|
27 | $sp1 = new ScatterPlot($datay,$datax); |
---|
28 | $sp1->mark->SetType(MARK_FILLEDCIRCLE); |
---|
29 | $sp1->mark->SetFillColor("red"); |
---|
30 | $sp1->mark->SetWidth(5); |
---|
31 | |
---|
32 | $graph->Add($sp1); |
---|
33 | $graph->Stroke(); |
---|
34 | |
---|
35 | ?> |
---|