I'm trying to make a graph with JPGragph, but I keep getting an error saying:
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);
I've tried to replace $ydata with an integer, but that only throws an fatal error.
Without the round and type cast, this is the var_dump of $ydata:
array(1) { [0]=> float(8.1102970953135) }
I just had the same problem using PHP 7.2 when the plot only contains one data point. The reason seems to be that JPGraph tries to put the single data point on the left and the right edge of the plot at the same time.
Using $plot->SetCenter();
fixed the issue for me and it looks better for BoxPlots.