我正在绘制一组可能包含null
或0
作为数据元素的数据的条形图。
例如:[30,12,30,60,30,12,30,0,30,12,30,60,]
但是使用JPGraph我得到的输出为
我正在寻找类似的东西
如img-2中所示,对于图D,数据值为0。但单行显示为基线/基准表示。
编辑:下面是代码
require_once('jpgraph/src/jpgraph.php');
require_once('jpgraph/src/jpgraph_bar.php');
//create the graph
$graph = new Graph(512,256); //set the width and the height
$graph->SetScale("textlin"); //set the scale of the graph
$graph->img->SetMargin(40,30,40,40);
$graph->xaxis->SetTickLabels(["Sept ","Oct ","Nov ","Dec ","Jan ","Feb ","March ","April ","May ","June ","July ","Aug ","Sept ","Oct "]);
$graph->xaxis->scale->ticks->Set(100,5);
$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
$data=array(30,12,30,60,30,12,30,0,30,12,30,60,); //prepare the data
// Create the bar plots and add it to the graph
$barplot = new BarPlot($data);
$graph->Add($barplot);
$path = $graph->Stroke();
$type = pathinfo($path, PATHINFO_EXTENSION);
$data = file_get_contents($path);
$base64 = 'data:image/' . $type . ';base64,' . base64_encode($data);