I'm trying to get the percentage of two values, as follows;
Code: Select all
while ($row = $result->fetch_array()) {
$title[] = (float)$row[0];
$valMissed[] = (float)$row[1];
$valError[] = (float)$row[2];
$valRecorded[] = (float)$row[3];
$valTot = $row[3] - $row[1];
$valSuccess[] = $valTot / $row[3] * 100;
}
$ret = array(($title[0] + 6000) * 1000, $valMissed, $valError, $valRecorded, $valSuccess);
$row[1] = 345
$valTot = 32984
On a calculator:
32984 / 33329 * 100 = 98.96 %
When I pull $valSuccess in highcharts (Javascript) it is returning 99.9%
It seems to be adding on 1% from somewhere..