作者mmm321 (家家)
看板PHP
标题[请益] JpGraph 无法调整颜色
时间Wed Mar 20 20:51:25 2013
今天刚开始接触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
1F:→ airtsubasa:物件设多个 放进array 03/20 21:39
2F:→ mmm321:请问A大,我用array放之後,他bar会一直叠上去,变成范例23那 03/20 21:43
3F:→ mmm321:样,不知道是不是我方法错误了 >< 03/20 21:43
自问自答一下
第一个问题出在 $b1plot->value->Show(); 的位置
第二个问题也谢谢a大的提点
我一直将bar的资料放在array里面,所以bar会一直往上叠
最後是将color放在array中,问题就解决了
$b1plot->SetFillColor($color20);
谢谢大家 :)
※ 编辑: mmm321 来自: 140.113.239.247 (03/20 22:33)