NEW stats invoice graph with 3 bars

This commit is contained in:
atm-quentin 2020-05-04 14:55:24 +02:00
parent 797beef79f
commit 1b35380dda
2 changed files with 11 additions and 3 deletions

View File

@ -58,8 +58,8 @@ if ($user->socid > 0)
$nowyear = strftime("%Y", dol_now());
$year = GETPOST('year') > 0 ?GETPOST('year') : $nowyear;
//$startyear=$year-2;
$startyear = $year - 1;
if(!empty($conf->global->INVOICE_STATS_GRAPHS_SHOW_2_YEARS)) $startyear=$year-2;
else $startyear=$year-1;
$endyear = $year;

View File

@ -894,7 +894,15 @@ class DolGraph
if ($i > $firstlot) $this->stringtoshow .= ', '."\n";
$color = sprintf("%02x%02x%02x", $this->datacolor[$i][0], $this->datacolor[$i][1], $this->datacolor[$i][2]);
$this->stringtoshow .= '{ ';
if (!isset($this->type[$i]) || $this->type[$i] == 'bars') $this->stringtoshow .= 'bars: { lineWidth: 1, show: true, align: "'.($i == $firstlot ? 'center' : 'left').'", barWidth: 0.5 }, ';
if (! isset($this->type[$i]) || $this->type[$i] == 'bars') {
if($nblot == 3) {
if($i == $firstlot) $align = 'right';
else if($i == $firstlot+1) $align = 'center';
else $align = 'left';
$this->stringtoshow.='bars: { lineWidth: 1, show: true, align: "'.$align.'", barWidth: 0.45 }, ';
}
else $this->stringtoshow.='bars: { lineWidth: 1, show: true, align: "'.($i==$firstlot?'center':'left').'", barWidth: 0.5 }, ';
}
if (isset($this->type[$i]) && ($this->type[$i] == 'lines' || $this->type[$i] == 'linesnopoint')) $this->stringtoshow .= 'lines: { show: true, fill: false }, points: { show: '.($this->type[$i] == 'linesnopoint' ? 'false' : 'true').' }, ';
$this->stringtoshow .= 'color: "#'.$color.'", label: "'.(isset($this->Legend[$i]) ? dol_escape_js($this->Legend[$i]) : '').'", data: d'.$i.' }';
$i++;