Simple example of php histogram generation jpgraph class library example

WBOY
Release: 2016-07-25 08:55:36
Original
968 people have browsed it
  1. /**
  2. * Use JpGraph to generate histogram
  3. * by bbs.it-home.org
  4. */
  5.  require_once '../jpgraph/src/jpgraph.php';
  6. '../jpgraph/src/jpgraph_bar.php';
  7.   // y-axis data, assigned in array form
  8.   $ydata = array(12,4,9,15,11,10,9,7,15,7) ;
  9.   // 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...)
  10.  $graph = new Graph(350,250 ,"auto");
  11.    // 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
  12.   $graph->SetScale("textlin");
  13.   // Create a coordinate class and use y-axis data injection
  14.   $lineplot=new LinePlot($ydata);
  15.   // The y-axis connection line is set to blue
  16.   $lineplot->SetColor("blue");
  17.   // The coordinate class is injected into the icon class
  18.   $ graph->Add($lineplot);
  19.   // Display graph
  20.   $graph->Stroke();
  21. ?>
Copy code

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template