diff --git a/Classes/Utility/Sparkline.php b/Classes/Utility/Sparkline.php index 55154c8..e7d8cde 100644 --- a/Classes/Utility/Sparkline.php +++ b/Classes/Utility/Sparkline.php @@ -13,6 +13,11 @@ class Sparkline */ private static function getY($max, $height, $diff, $value) { + // prevent division by zero + if ($max === 0) { + return round(floatval(($height + $diff)), 2); + } + return round(floatval(($height - ($value * $height / $max) + $diff)), 2); } @@ -58,4 +63,4 @@ public static function sparkline($svgClass, $values, $lineColor = '#aaa', $fillC return '' . $svg; } -} \ No newline at end of file +}