[42] | 1 | <?php // content="text/plain; charset=utf-8" |
---|
| 2 | require_once ('jpgraph/jpgraph.php'); |
---|
| 3 | require_once ('jpgraph/jpgraph_line.php'); |
---|
| 4 | |
---|
| 5 | $datay = array(0,25,12,47,27,27,0); |
---|
| 6 | |
---|
| 7 | // Setup the graph |
---|
| 8 | $graph = new Graph(350,250); |
---|
| 9 | $graph->SetScale("intlin",0,$aYMax=50); |
---|
| 10 | |
---|
| 11 | $theme_class= new UniversalTheme; |
---|
| 12 | $graph->SetTheme($theme_class); |
---|
| 13 | |
---|
| 14 | $graph->SetMargin(40,40,50,40); |
---|
| 15 | |
---|
| 16 | $graph->title->Set('Inverted Y-axis'); |
---|
| 17 | $graph->SetBox(false); |
---|
| 18 | $graph->yaxis->HideLine(false); |
---|
| 19 | $graph->yaxis->HideTicks(false,false); |
---|
| 20 | |
---|
| 21 | // For background to be gradient, setfill is needed first. |
---|
| 22 | $graph->ygrid->SetFill(true,'#FFFFFF@0.5','#FFFFFF@0.5'); |
---|
| 23 | $graph->SetBackgroundGradient('#FFFFFF', '#00FF7F', GRAD_HOR, BGRAD_PLOT); |
---|
| 24 | |
---|
| 25 | $graph->xaxis->SetTickLabels(array('G','F','E','D','C','B','A')); |
---|
| 26 | $graph->xaxis->SetLabelMargin(20); |
---|
| 27 | $graph->yaxis->SetLabelMargin(20); |
---|
| 28 | |
---|
| 29 | $graph->SetAxisStyle(AXSTYLE_BOXOUT); |
---|
| 30 | $graph->img->SetAngle(180); |
---|
| 31 | |
---|
| 32 | // Create the line |
---|
| 33 | $p1 = new LinePlot($datay); |
---|
| 34 | $graph->Add($p1); |
---|
| 35 | |
---|
| 36 | $p1->SetFillGradient('#FFFFFF','#F0F8FF'); |
---|
| 37 | $p1->SetColor('#aadddd'); |
---|
| 38 | |
---|
| 39 | // Output line |
---|
| 40 | $graph->Stroke(); |
---|
| 41 | |
---|
| 42 | ?> |
---|
| 43 | |
---|
| 44 | |
---|