Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
include ("../jpgraph.php");
3
include ("../jpgraph_bar.php");
4
 
5
$data = array(0.1235,0.4567,0.67,0.45,0.832);
6
 
7
// Callback function
8
// Get called with the actual value and should return the
9
// value to be displayed as a string
10
function cbFmtPercentage($aVal) {
11
    return sprintf("%.1f%%",100*$aVal); // Convert to string
12
}
13
 
14
// Create the graph.
15
$graph = new Graph(400,300);
16
$graph->SetScale("textlin");
17
 
18
// Create a bar plots
19
$bar1 = new BarPlot($data);
20
 
21
// Setup the callback function
22
$bar1->value->SetFormatCallback("cbFmtPercentage");
23
$bar1->value->Show();
24
 
25
// Add the plot to the graph
26
$graph->Add($bar1);
27
 
28
// .. and send the graph back to the browser
29
$graph->Stroke();
30
?>