From ea658ebe72d96650d8dcbd5c4f9b2618c71673d6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 6 Mar 2020 09:51:30 +0100 Subject: [PATCH] Fix setShowLegend with chartjs --- htdocs/core/class/dolgraph.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index b63eb193c6e..460b425b8aa 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -1146,6 +1146,9 @@ class DolGraph $this->stringtoshow .= 'var options = { maintainAspectRatio: false, aspectRatio: 2.5, '; + if (empty($showlegend)) { + $this->stringtoshow .= 'legend: { display: false }, '; + } $this->stringtoshow .= 'scales: { xAxes: [{ '; //$this->stringtoshow .= 'type: \'time\', '; // Need Moment.js $this->stringtoshow .= 'distribution: \'linear\'';