JPGraph barplot从GroupBarPlot中删除0个值

时间:2015-01-09 07:38:11

标签: php bar-chart jpgraph

我制作了一个带有一些值的JPGraph图,但有时我的值为空(0),就像这个例子jpgraph example

我想将现有的条形图分组到标签的中间。例如,在第二个标签(绿色和红色条),我想将这两个条粘在标签的中心。现在,您可以在两个条形图的中间看到黄色的空值。

是否可以从绘图中删除空条,因为如果我从绘图数组中删除空值,JPGraph会注意到数组的长度不正确并抛出错误或者不打印绘图。 / p>

2 个答案:

答案 0 :(得分:0)

$graph = new Graph\PieGraph(400, 300);
$p1 = new Plot\PiePlotC($data);
$p1->value->HideZero(true);
$graph->Add($p1);
$graph->Stroke();

答案 1 :(得分:-1)

您可以使用GroupBarPlot。

$gbplot = new GroupBarPlot($plotsArray);
$graph->Add($gbplot);

参见文档:

http://jpgraph.net/download/manuals/chunkhtml/ch15s02.html

http://jpgraph.net/download/manuals/classref/GroupBarPlot.html

我想隐藏0值,如果有人知道解决方案......