From f4b2a6ec9235545f84b5f58ade7fbc7eaa769de6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 8 Nov 2021 14:51:14 +0100 Subject: [PATCH] Fix negative colors for bars --- htdocs/core/class/dolgraph.class.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 59213e9066e..a93ed92e8f5 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -1431,6 +1431,14 @@ class DolGraph $bordercolor = $this->bordercolor[$i]; } } + + // For negative colors, we invert border and background + $tmp = str_replace('#', '', $color); + if (strpos($tmp, '-') !== false) { + $foundnegativecolor++; + $bordercolor = str_replace('-', '', $color); + $color = '#FFFFFF'; // If $val is '-123' + } } if ($i > 0) { $this->stringtoshow .= ', ';