国产探花免费观看_亚洲丰满少妇自慰呻吟_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柱狀圖實例代碼


官方網站   武林網下載地址

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 荣成市| 邵阳县| 宝坻区| 同江市| 德安县| 平南县| 桂阳县| 万安县| 丰镇市| 武胜县| 申扎县| 玛纳斯县| 彰化市| 太和县| 宁国市| 乐清市| 福鼎市| 舞钢市| 闽清县| 栾城县| 乡城县| 竹溪县| 闸北区| 崇信县| 安化县| 嘉黎县| 沈阳市| 东安县| 茂名市| 阿拉善左旗| 永登县| 综艺| 伊金霍洛旗| 航空| 包头市| 新建县| 浏阳市| 藁城市| 林口县| 增城市| 汨罗市|