php實現報表(jpgraph外掛程式實現)

來源:互聯網
上載者:User
jpgraph的安裝和配置

1,官網下載 檔案包

2,解壓 檔案包

3,拷貝到你的開發環境下----注意的是:把src目錄的所有其他檔案 全部剪下到Examples檔案內,在剪下是先在Examples內建立jpgraph檔案夾(名字一定得是jpgraph,因為其功能檔案引用都是這個檔案名稱為準)

只留下docportal 和 Examples 這個2個檔案即可

4,執行你本地的環境---即可看見所有的jpgraph案例:http://localhost/Bbiao/jpgraph/Examples/


jpgraph支援語言檔案 -------- jpgraph_ttf.inc.php

// Chinese font
define("FF_SIMSUN",30);
define("FF_CHINESE",31);
define("FF_BIG5",32);



比如:

require_once ('jpgraph/jpgraph.php');
require_once ('jpgraph/jpgraph_bar.php');

$datay1=array(13,8,19,7,17,6);
$datay2=array(40,5,2,7,5,25);

// Create the graph.
$graph = new Graph(350,250);
$graph->SetScale('textlin');
$graph->SetMarginColor('white');

// Setup title
$graph->title->Set(iconv("UTF-8","GB2312//IGNORE","咋地三炮,我要支援中文!")) ; //支援中文標題
$graph->title->SetFont(FF_SIMSUN,FS_BOLD,14);
// Create the first bar
$bplot = new BarPlot($datay1);
$bplot->SetFillGradient('AntiqueWhite2','AntiqueWhite4:0.8',GRAD_VERT);
$bplot->SetColor('darkred');

// Create the second bar
$bplot2 = new BarPlot($datay2);
$bplot2->SetFillGradient('olivedrab1','olivedrab4',GRAD_VERT);
$bplot2->SetColor('darkgreen');

// And join them in an accumulated bar
$accbplot = new AccBarPlot(array($bplot,$bplot2));
$graph->Add($accbplot);

$graph->Stroke();
?>

既可實現php報表需求!

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.