Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/294.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php JPGraph错误,绘图的比例非法_Php_Jpgraph - Fatal编程技术网

Php JPGraph错误,绘图的比例非法

Php JPGraph错误,绘图的比例非法,php,jpgraph,Php,Jpgraph,我正试图用JPGragph制作一个图表,但我一直收到一个错误,上面说: JpGraph Error A plot has an illegal scale. This could for example be that you are trying to use text auto scaling to draw a line plot with only one point or that the plot area is too small. It could also be that no

我正试图用JPGragph制作一个图表,但我一直收到一个错误,上面说:

JpGraph Error A plot has an illegal scale. This could for example be that you are trying to use text auto scaling to draw a line plot with only one point or that the plot area is too small. It could also be that no input data value is numeric (perhaps only '-' or 'x')

$ydata = round($ydata[0]); // An attempt to convert float to int
$ydata = (int)$ydata; // That didn't bring any solution(thought it couldn't handle float)

$pt = new LinePlot($ydata); // Here is where the error is thrown
$bar2->Add($pt);
$pt->SetColor("blue");
$pt->SetWeight(10);
我尝试用整数替换$ydata,但这只会引发致命错误

如果没有圆形和类型转换,这是$ydata的var_转储:

array(1) { [0]=> float(8.1102970953135) }

使用PHP7?我得到了相同的错误,并发现:

他们说你的PHP安装是“错误的”


帮助我的是向数据数组添加第二个值-只有一个值不起作用。

当绘图仅包含一个数据点时,我使用PHP7.2时遇到了同样的问题。 原因似乎是JPGraph试图将单个数据点同时放在绘图的左边缘和右边缘

使用
$plot->SetCenter()为我修复了这个问题,它在箱线图中看起来更好