繁体   English   中英

JPGraph错误,地块比例不合法

[英]JPGraph error, A plot has an illegal scale

我正在尝试使用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_dump:

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

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

使用$plot->SetCenter(); 为我解决了这个问题,对于BoxPlots来说看起来更好。

使用PHP 7? 我遇到了同样的错误,发现了这一点:

http://jpgraph.net/doc/faq.php#F4-13

他们说您的PHP安装“有问题”。

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM