Re: [請益]有關Jpgraph安裝與繪圖應用

看板PHP作者 (RAY)時間16年前 (2009/12/28 18:06), 編輯推噓0(001)
留言1則, 1人參與, 最新討論串3/3 (看更多)
這是 jpgraphe example裡面的其中一個 長條圖範例 小弟之前將他修改成公司需要的圖表 你看看吧 公司總工有7間店 我將它用成分別 不同的顏色 然後就有 7個plot 分別是 b1plot ~ b7plot (變數是data1y~data7y) $gbplot 是 將上面7個加起來 長條 圖顯示出來就會是每天 七間店的營業額加起來 然後每間店的營業額又會用不 同顏色顯示 include ("../jpgraph.php"); include ("../jpgraph_bar.php"); setlocale (LC_ALL, 'et_EE.ISO-8859-1'); // Create the graph. These two calls are always required $graph = new Graph(1000,700,"auto"); $graph->SetScale("textlin"); $graph->SetShadow(); $graph->img->SetMargin(40,30,20,40); // Create the bar plots $b1plot = new BarPlot($data1y); $b1plot->SetFillColor("orange"); $b1plot->value->Show(); $b1plot->value->SetFont(FF_FONT2, FS_BOLD); $b2plot = new BarPlot($data2y); $b2plot->SetFillColor("blue"); $b2plot->value->Show(); $b2plot->value->SetFont(FF_FONT2, FS_BOLD); $b3plot = new BarPlot($data3y); $b3plot->SetFillColor("aqua"); $b3plot->value->Show(); $b3plot->value->SetFont(FF_FONT2, FS_BOLD); $b4plot = new BarPlot($data4y); $b4plot->SetFillColor("gold"); $b4plot->value->Show(); $b4plot->value->SetFont(FF_FONT2, FS_BOLD); $b5plot = new BarPlot($data5y); $b5plot->SetFillColor("green"); $b5plot->value->Show(); $b5plot->value->SetFont(FF_FONT2, FS_BOLD); $b6plot = new BarPlot($data6y); $b6plot->SetFillColor("white"); $b6plot->value->Show(); $b6plot->value->SetFont(FF_FONT2, FS_BOLD); $b7plot = new BarPlot($data7y); $b7plot->SetFillColor("black"); $b7plot->value->Show(); $b7plot->value->SetFont(FF_FONT2, FS_BOLD); //The text $b7plot->SetLegend("SHOP A"); $b6plot->SetLegend("SHOP B"); $b5plot->SetLegend("SHOP C"); $b4plot->SetLegend("SHOP D"); $b3plot->SetLegend("SHOP E"); $b2plot->SetLegend("SHOP F"); $b1plot->SetLegend("SHOP G"); // Create the grouped bar plot $gbplot = new AccBarPlot(array($b1plot,$b2plot,$b3plot,$b4plot,$b5plot,$b6plot,$b7plot)); // ...and add it to the graPH $graph->Add($gbplot); $graph->title->Set("Money/Date"); $graph->xaxis->title->Set("Date"); $graph->yaxis->title->Set("Money"); $graph->title->SetFont(FF_FONT1,FS_BOLD); $graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD); $graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD); // Display the graph $graph->Stroke(); ※ 引述《heysimon (嘿~賽門)》之銘言: : 1.安裝 : 我的是php5,因此到官網下載了jpgraph-3.0.6.tar.bz2 : 解壓縮後,把這個檔案放到 C:AppServ\www\jpgraph : 開啟php.ini文件並修改其中的include_path參數 : 找到include_path並修改 include_path = ".;C:AppServ\www\jpgraph" : 點選ApacheRestart,重新啟動Apache服務器 : 請問以上過程是否正確? 還需要做甚麼修改嗎? : (小弟不知道該如何測試是否成功?...) : 2.繪統計圖表 : src裡面的example有很多範例,但我不知道該如何運用...(慘) : 假設我現在有五筆產品的各別月銷售量($p1,$p2,$p3,$p4,$p5) : 月資料有($m1,$m2,...$m12) : 請問要如何畫出一個長方圖? (橫軸月,縱軸銷售量) : 可否請前輩秀一個簡單的程式碼...^^ : ps.其它圖表的應用可以去哪裡查詢? : 感謝!! -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 219.95.163.213

12/29 02:13, , 1F
感謝您~~ 我會研究一下!!
12/29 02:13, 1F
文章代碼(AID): #1BE8D0y_ (PHP)
文章代碼(AID): #1BE8D0y_ (PHP)