国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > PHP > 正文

php報表之jpgraph柱狀圖實例代碼

2024-05-04 23:17:16
字體:
來源:轉載
供稿:網友
新手初識jpgraph肯定會遇到各種各樣的問題,比如亂碼什么的,本案例是jpgraph3.0.7制作,也經過本人的多次實驗,解決亂碼問題

復制代碼 代碼如下:


<?php
$datay=array(); //縱坐標數據
$datax=array(); //橫坐標數據
foreach ($usernums as $key => $value){
$datay[] = $value;
$datax[] = $userids[$key];
}
require_once (‘jpgraph-3.0.7/jpgraph/jpgraph.php');
require_once (‘jpgraph-3.0.7/jpgraph/jpgraph_bar.php');
// Create the graph. These two calls are always required
$graph = new Graph(800,600); //圖像高寬
$graph->SetScale(“textlin”);
$graph->xaxis->SetTickLabels($datax);
$graph->xaxis->SetFont(FF_VERDANA,FS_NORMAL,10);
$graph->xaxis->SetLabelAngle(30);
$graph->yaxis->scale->SetGrace(20);
$graph->xaxis->scale->SetGrace(20);
// Add a drop shadow
$graph->SetShadow();
// Adjust the margin a bit to make more room for titles
$graph->img->SetMargin(40,30,20,40);
// Create a bar pot
$bplot = new BarPlot($datay);
// Adjust fill color
$bplot->SetFillColor(‘orange');
$bplot->value->Show();
$bplot->value->SetFont(FF_ARIAL,FS_BOLD,10);
$bplot->value->SetAngle(45);
$bplot->value->SetFormat(‘%d');
$graph->Add($bplot);
// Setup the titles
$graph->title->Set(iconv(“UTF-8″, “gb2312″,”用戶消費報表圖”));
$graph->xaxis->title->Set(iconv(“UTF-8″, “gb2312″,”用戶姓名”));
$graph->yaxis->title->Set(iconv(“UTF-8″, “gb2312″,”用戶訂單數量”));
$graph->xaxis->title->SetFont(FF_SIMSUN,FS_BOLD);
$graph->yaxis->title->SetFont(FF_SIMSUN,FS_BOLD);
$graph->title->SetFont(FF_SIMSUN,FS_BOLD);
// Display the graph
$graph->Stroke();
?>


效果圖:

php報表之jpgraph柱狀圖實例代碼


官方網站   武林網下載地址

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 榆中县| 新宁县| 漳平市| 瑞金市| 兴海县| 德惠市| 丰宁| 毕节市| 洮南市| 句容市| 宁远县| 广安市| 泗阳县| 合川市| 龙岩市| 马尔康县| 淮滨县| 栾城县| 庐江县| 萨迦县| 额济纳旗| 雅安市| 紫金县| 曲靖市| 湟源县| 荥经县| 宁都县| 海城市| 秦皇岛市| 玉山县| 杨浦区| 浑源县| 枣阳市| 信丰县| 信宜市| 泸水县| 教育| 武定县| 精河县| 隆子县| 上思县|