Sort fix #698 [skip ci]

This commit is contained in:
James Cole 2017-07-14 17:21:30 +02:00
parent 2bf54d0b8e
commit c4ff05b1ba
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E

View File

@ -110,7 +110,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 is positive, sort other way around.
arsort($data);
}
$index = 0;
foreach ($data as $key => $value) {