[請益] JpGraph 無法調整顏色

看板PHP作者 (家家)時間12年前 (2013/03/20 20:51), 編輯推噓0(003)
留言3則, 2人參與, 最新討論串1/1
今天剛開始接觸jpgraph 想要用來畫一些簡單的統計圖 沒想到一開始就遇到問題 > < 想要改變Bar的顏色,卻無法改,會一直維持範例的藍色 http://ppt.cc/yO~3 http://mach.ipm.virginia.edu/jpgraph/docs/html/exframes/frame_example18.html 想請教大家我是不是漏掉要設定什麼? 如果同一根Bar要畫第二筆資料,則會跟範例23一樣,第二次add的bar會是粉紅色的 http://ppt.cc/_i4z 另外想再請問, 如果我每一個Bar都想要是不同顏色的話,要怎麼設定呢? EX: http://ppt.cc/F1gw 麻煩大家指點了 以下是我目前的Code php code: require_once ('jpgraph/src/jpgraph.php'); require_once ('jpgraph/src/jpgraph_bar.php'); $graph = new Graph(1024,768,"auto"); $graph->SetScale("textlin"); $graph->SetShadow(); $graph->img->SetMargin(40,30,20,40); $b1plot = new BarPlot($data); $b1plot->SetFillColor('orange'); $graph->Add($b1plot); //$gbplot = new AccBarPlot(array($b1plot)); //$graph->Add($gbplot); $graph->title->Set("TITLE"); $graph->xaxis->title->Set("X"); $graph->yaxis->title->Set("Y"); $graph->title->SetFont(FF_FONT1,FS_BOLD); $graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD); $graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD); $graph->Stroke(); -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.113.239.247

03/20 21:39, , 1F
物件設多個 放進array
03/20 21:39, 1F

03/20 21:43, , 2F
請問A大,我用array放之後,他bar會一直疊上去,變成範例23那
03/20 21:43, 2F

03/20 21:43, , 3F
樣,不知道是不是我方法錯誤了 ><
03/20 21:43, 3F
自問自答一下 第一個問題出在 $b1plot->value->Show(); 的位置 第二個問題也謝謝a大的提點 我一直將bar的資料放在array裡面,所以bar會一直往上疊 最後是將color放在array中,問題就解決了 $b1plot->SetFillColor($color20); 謝謝大家 :) ※ 編輯: mmm321 來自: 140.113.239.247 (03/20 22:33)
文章代碼(AID): #1HIR3GcA (PHP)
文章代碼(AID): #1HIR3GcA (PHP)