From 32ee3122acda5574a279173d234e0a9f94244f09 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 6 Mar 2020 02:24:24 +0100 Subject: [PATCH] More accurate code --- htdocs/core/class/dolgraph.class.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 98c0bcde90c..94812f84f2c 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -1145,10 +1145,18 @@ class DolGraph if (isset($this->type[$firstlot]) && ($this->type[$firstlot] == 'lines' || $this->type[$firstlot] == 'linesnopoint')) $type = 'line'; - $this->stringtoshow .= 'var options = { maintainAspectRatio: false, aspectRatio: 2.5'; + $this->stringtoshow .= 'var options = { maintainAspectRatio: false, aspectRatio: 2.5, '; + $this->stringtoshow .= 'scales: { xAxes: [{ '; + //$this->stringtoshow .= 'type: \'time\', '; // Need Moment.js + $this->stringtoshow .= 'distribution: \'linear\''; if (count($arrayofgroupslegend) > 0) { - $this->stringtoshow .= ', scales: {xAxes: [{ stacked: true, }], yAxes: [{ stacked: true }] }'; + $this->stringtoshow .= ', stacked: true'; } + $this->stringtoshow .= ' }]'; + if (count($arrayofgroupslegend) > 0) { + $this->stringtoshow .= ', yAxes: [{ stacked: true }]'; + } + $this->stringtoshow .= ' }'; $this->stringtoshow .= '};'; $this->stringtoshow .= '