>[success] ### 以線性圖為例代碼分析
1.引入類庫
require_once "/src/jpgraph.php"; //核心文件
require_once "/src/jpgraph_line.php"; //線性圖文件
2.引入數據
$data=array(1=>1,...);
3.得到Graph對象(創建畫布)
$graph=new Graph(w,h); //w-畫布長;h-畫布寬
4.設置X和Y軸樣式及Y軸的最大值最小值
$graph->SetScale($aAxisType,$min,$max);//如:$aAxisType='textint';則x坐標樣式為text,y坐標樣式為int
5.設置圖像樣式,如加入陰影
$graph->SetShadow();
6.設置圖像邊界范圍
$graph->img->setMargin($up,$right,$down,$left);//順時針填充值
7.設置標題
$graph->title->Set($title);//中文參見問題解決
8.得到曲線實例(插入數據)
$linePlot=new LinePlot($data);
9.將曲線加入到圖像中
$graph->Add($linePlot);
10.設置曲線的顏色
$linePlot->setColor($color);//代碼位置參見問題解決
11.設置坐標軸名稱
$graph->xaxis->title->Set($xName); //X坐標軸名稱
$graph->yaxis->title->Set($yName);//y坐標軸名稱
12.設置曲線的圖例
$linePlot->SetLegend($legend);//中文參見問題解決
13.設置圖例樣式
$graph->legend->setlayout(LEGEND_HOR);
14設置圖例位置
$graph->legend->Pos(0.45,0.9,"center","bottom");
15輸出
$graph->Stroke();//將圖像輸出到瀏覽器
$graph->Stroke($path);//如:$graph->Stroke('./test.png');保存到當前目錄下并命名test