Rev | Line | |
---|
[42] | 1 | <?php // content="text/plain; charset=utf-8"
|
---|
| 2 | require_once ('jpgraph/jpgraph.php');
|
---|
| 3 | require_once ('jpgraph/jpgraph_bar.php');
|
---|
| 4 |
|
---|
| 5 | // Some data
|
---|
| 6 | $months=$gDateLocale->GetShortMonth();
|
---|
| 7 |
|
---|
| 8 | srand ((double) microtime() * 1000000);
|
---|
| 9 | for( $i=0; $i<25; ++$i) {
|
---|
| 10 | $databary[]=rand(1,50);
|
---|
| 11 | $databarx[]=$months[$i%12];
|
---|
| 12 | }
|
---|
| 13 |
|
---|
| 14 | // New graph with a drop shadow
|
---|
| 15 | $graph = new Graph(300,200,'auto');
|
---|
| 16 | $graph->SetShadow();
|
---|
| 17 |
|
---|
| 18 | // Use a "text" X-scale
|
---|
| 19 | $graph->SetScale("textlin");
|
---|
| 20 |
|
---|
| 21 | // Specify X-labels
|
---|
| 22 | $graph->xaxis->SetTickLabels($databarx);
|
---|
| 23 |
|
---|
| 24 | // Set title and subtitle
|
---|
| 25 | $graph->title->Set("Bar tutorial example 3");
|
---|
| 26 |
|
---|
| 27 | // Use built in font
|
---|
| 28 | $graph->title->SetFont(FF_FONT1,FS_BOLD);
|
---|
| 29 |
|
---|
| 30 | // Create the bar plot
|
---|
| 31 | $b1 = new BarPlot($databary);
|
---|
| 32 | $b1->SetLegend("Temperature");
|
---|
| 33 | //$b1->SetAbsWidth(6);
|
---|
| 34 | //$b1->SetShadow();
|
---|
| 35 |
|
---|
| 36 | // The order the plots are added determines who's ontop
|
---|
| 37 | $graph->Add($b1);
|
---|
| 38 |
|
---|
| 39 | // Finally output the image
|
---|
| 40 | $graph->Stroke();
|
---|
| 41 |
|
---|
| 42 | ?>
|
---|
| 43 |
|
---|
| 44 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.