Home >Backend Development >PHP Tutorial >How to use Jpgraph to draw a simple X-Y coordinate graph in php, jpgraphx-y_PHP tutorial

How to use Jpgraph to draw a simple X-Y coordinate graph in php, jpgraphx-y_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-13 09:51:20955browse

php uses Jpgraph to draw a simple X-Y coordinate graph, jpgraphx-y

This article describes the example of php using Jpgraph to draw a simple X-Y coordinate graph. Share it with everyone for your reference. The specific implementation method is as follows:

<&#63;php 
include ("src/jpgraph.php"); 
include ("src/jpgraph_line.php"); 
//将要用于图表创建的数据存放在数组中 
$data = array(19,23,34,38,45,67,71,78,85,87,90,96); 
$graph = new Graph(400,300); //创建新的Graph对象 
$graph->SetScale("textlin"); //设置刻度样式 
$graph->img->SetMargin(30,30,80,30); //设置图表边界 
$graph->title->Set("Year to Date Cost"); //设置图表标题 
// Create the linear plot 
$lineplot=new LinePlot($data); // 创建新的LinePlot对象 
$lineplot->SetLegend("Amount(M dollars)"); //设置图例文字 
$lineplot->SetColor("red"); // 设置曲线的颜色 
// Add the plot to the graph 
$graph->Add($lineplot); //在统计图上绘制曲线 
// Display the graph 
$graph->Stroke(); //输出图像 
&#63;>

The rendering after operation is as follows:

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1014423.htmlTechArticlephp uses Jpgraph to draw a simple X-Y coordinate chart, jpgraphx-y This article describes an example of using Jpgraph to draw a simple X-Y Coordinate diagram method. Share it with everyone for your reference. Specific implementation method...
Statement:
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