1 | <?php // content="text/plain; charset=utf-8" |
---|
2 | require_once ('jpgraph/jpgraph.php'); |
---|
3 | require_once ('jpgraph/jpgraph_bar.php'); |
---|
4 | |
---|
5 | $datay=array(17,22,33,48,24,20); |
---|
6 | |
---|
7 | |
---|
8 | // Create the graph. These two calls are always required |
---|
9 | $graph = new Graph(220,300,'auto'); |
---|
10 | $graph->SetScale("textlin"); |
---|
11 | |
---|
12 | $theme_class=new UniversalTheme; |
---|
13 | $graph->SetTheme($theme_class); |
---|
14 | |
---|
15 | $graph->Set90AndMargin(50,40,40,40); |
---|
16 | $graph->img->SetAngle(90); |
---|
17 | |
---|
18 | // set major and minor tick positions manually |
---|
19 | $graph->SetBox(false); |
---|
20 | |
---|
21 | //$graph->ygrid->SetColor('gray'); |
---|
22 | $graph->ygrid->Show(false); |
---|
23 | $graph->ygrid->SetFill(false); |
---|
24 | $graph->xaxis->SetTickLabels(array('A','B','C','D','E','F')); |
---|
25 | $graph->yaxis->HideLine(false); |
---|
26 | $graph->yaxis->HideTicks(false,false); |
---|
27 | |
---|
28 | // For background to be gradient, setfill is needed first. |
---|
29 | $graph->SetBackgroundGradient('#00CED1', '#FFFFFF', GRAD_HOR, BGRAD_PLOT); |
---|
30 | |
---|
31 | // Create the bar plots |
---|
32 | $b1plot = new BarPlot($datay); |
---|
33 | |
---|
34 | // ...and add it to the graPH |
---|
35 | $graph->Add($b1plot); |
---|
36 | |
---|
37 | $b1plot->SetWeight(0); |
---|
38 | $b1plot->SetFillGradient("#808000","#90EE90",GRAD_HOR); |
---|
39 | $b1plot->SetWidth(17); |
---|
40 | |
---|
41 | // Display the graph |
---|
42 | $graph->Stroke(); |
---|
43 | ?> |
---|