Divide by zero
Brought to you by:
nosey
I get the following error for my graph:
Warning: Division by zero
in /opt/eperf/matay/graphpite/Image/Graph/Axis.php on
line 404
This is the problematic line:
$labelInterval = $this->_axisSpan()/($this-
>_axisValueSpan()/$this->_labelInterval());
The problem occurs because _axisValueSpan() or
_labelInterval() may return 0, therefore creating a "divide
by zero" scenario.
It occurred for me every time all of my DataSet values
are 0. I fixed it with the following change:
<insert before line 404>
if (($this->_axisValueSpan() == 0) || ($this-
>_labelInterval() == 0)) {
$labelInterval = 1;
}
else
I'm guessing it's not the best fix, but it works for my
case.