-
- /**
- * Use JpGraph to generate histogram
- * by bbs.it-home.org
- */
- require_once '../jpgraph/src/jpgraph.php';
- '../jpgraph/src/jpgraph_bar.php';
- // y-axis data, assigned in array form
- $ydata = array(12,4,9,15,11,10,9,7,15,7) ;
- // Create a Graph class, 350 is the width, 250 is the length, auto: means that the generated cache file name is the file name + extension of the file (.jpg .png .gif...)
- $graph = new Graph(350,250 ,"auto");
- // Set the scale type. The x-axis scale can be used as a straight-line scale for text labeling, and the y-axis is a straight-line scale
- $graph->SetScale("textlin");
- // Create a coordinate class and use y-axis data injection
- $lineplot=new LinePlot($ydata);
- // The y-axis connection line is set to blue
- $lineplot->SetColor("blue");
- // The coordinate class is injected into the icon class
- $ graph->Add($lineplot);
- // Display graph
- $graph->Stroke();
- ?>
-
Copy code
|