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(62,105,85,50);
|
---|
6 |
|
---|
7 |
|
---|
8 | // Create the graph. These two calls are always required
|
---|
9 | $graph = new Graph(350,220,'auto');
|
---|
10 | $graph->SetScale("textlin");
|
---|
11 |
|
---|
12 | //$theme_class="DefaultTheme";
|
---|
13 | //$graph->SetTheme(new $theme_class());
|
---|
14 |
|
---|
15 | // set major and minor tick positions manually
|
---|
16 | $graph->yaxis->SetTickPositions(array(0,30,60,90,120,150), array(15,45,75,105,135));
|
---|
17 | $graph->SetBox(false);
|
---|
18 |
|
---|
19 | //$graph->ygrid->SetColor('gray');
|
---|
20 | $graph->ygrid->SetFill(false);
|
---|
21 | $graph->xaxis->SetTickLabels(array('A','B','C','D'));
|
---|
22 | $graph->yaxis->HideLine(false);
|
---|
23 | $graph->yaxis->HideTicks(false,false);
|
---|
24 |
|
---|
25 | // Create the bar plots
|
---|
26 | $b1plot = new BarPlot($datay);
|
---|
27 |
|
---|
28 | // ...and add it to the graPH
|
---|
29 | $graph->Add($b1plot);
|
---|
30 |
|
---|
31 |
|
---|
32 | $b1plot->SetColor("white");
|
---|
33 | $b1plot->SetFillGradient("#4B0082","white",GRAD_LEFT_REFLECTION);
|
---|
34 | $b1plot->SetWidth(45);
|
---|
35 | $graph->title->Set("Bar Gradient(Left reflection)");
|
---|
36 |
|
---|
37 | // Display the graph
|
---|
38 | $graph->Stroke();
|
---|
39 | ?>
|
---|