[42] | 1 | <?php // content="text/plain; charset=utf-8" |
---|
| 2 | require_once ('jpgraph/jpgraph.php'); |
---|
| 3 | require_once ('jpgraph/jpgraph_line.php'); |
---|
| 4 | |
---|
| 5 | $ydata = array(11,3,8,12,5,1,9,13,5,7); |
---|
| 6 | |
---|
| 7 | // Create the graph. These two calls are always required |
---|
| 8 | $graph = new Graph(300,250); |
---|
| 9 | $graph->SetScale('intlin',0,10); |
---|
| 10 | $graph->SetMargin(30,20,70,40); |
---|
| 11 | $graph->SetMarginColor(array(177,191,174)); |
---|
| 12 | |
---|
| 13 | $graph->SetClipping(true); |
---|
| 14 | |
---|
| 15 | $graph->xaxis->SetFont(FF_FONT1,FS_BOLD); |
---|
| 16 | |
---|
| 17 | $graph->ygrid->SetLineStyle('dashed'); |
---|
| 18 | |
---|
| 19 | $graph->title->Set("Manual scale"); |
---|
| 20 | $graph->title->SetFont(FF_ARIAL,FS_BOLD,14); |
---|
| 21 | $graph->title->SetColor('white'); |
---|
| 22 | $graph->subtitle->Set("(With clipping)"); |
---|
| 23 | $graph->subtitle->SetColor('white'); |
---|
| 24 | $graph->subtitle->SetFont(FF_ARIAL,FS_BOLD,10); |
---|
| 25 | |
---|
| 26 | // Create the linear plot |
---|
| 27 | $lineplot=new LinePlot($ydata); |
---|
| 28 | $lineplot->SetColor("red"); |
---|
| 29 | $lineplot->SetWeight(2); |
---|
| 30 | |
---|
| 31 | // Add the plot to the graph |
---|
| 32 | $graph->Add($lineplot); |
---|
| 33 | |
---|
| 34 | // Display the graph |
---|
| 35 | $graph->Stroke(); |
---|
| 36 | ?> |
---|