diff --git a/inc/stat.class.php b/inc/stat.class.php index b9f0765899b..03b30b3e76d 100644 --- a/inc/stat.class.php +++ b/inc/stat.class.php @@ -1323,19 +1323,21 @@ function getRights($interface = 'central') { * ['name' => 'a name', 'data' => []], * ['name' => 'another name', 'data' => []] * ] - * @param integer $witdh Graph width. Defaults to 900 + * @param array $options Options * @param boolean $display Whether to display directly; defauts to true * * @return void */ public function displayLineGraph($title, $labels, $series, $options = null, $display = true) { + global $CFG_GLPI; $param = [ 'width' => 900, 'height' => 300, 'tooltip' => true, 'legend' => true, - 'animate' => true + 'animate' => true, + 'csv' => true ]; if (is_array($options) && count($options)) { @@ -1346,7 +1348,15 @@ public function displayLineGraph($title, $labels, $series, $options = null, $dis $slug = str_replace('-', '_', Toolbox::slugify($title)); $this->checkEmptyLabels($labels); - $out = "

$title

"; + $out = "

$title"; + if ($param['csv']) { + $csvfilename = $this->generateCsvFile($labels, $series, $options); + $out .= " ".__('CSV'). + ""; + } + $out .= "

"; $out .= "
"; Html::requireJs('charts'); $out .= "