From 0c6c4d59593094d43a94bfcb38a08046e1e8bd05 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 15 Jul 2017 10:26:27 +0200 Subject: [PATCH] Fix small issue in chart. --- app/Generator/Chart/Basic/ChartJsGenerator.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Generator/Chart/Basic/ChartJsGenerator.php b/app/Generator/Chart/Basic/ChartJsGenerator.php index 4112e41d36..b8086880f4 100644 --- a/app/Generator/Chart/Basic/ChartJsGenerator.php +++ b/app/Generator/Chart/Basic/ChartJsGenerator.php @@ -112,10 +112,12 @@ class ChartJsGenerator implements GeneratorInterface // sort by value, keep keys. // different sort when values are positive and when they're negative. asort($data); - if(bccomp(next($data),'0') === 1) { + $next = next($data); + if (!is_bool($next) && bccomp($next, '0') === 1) { // next is positive, sort other way around. arsort($data); } + unset($next); $index = 0; foreach ($data as $key => $value) {