From 143e2a6c3f13156dbe48c8082310bd3ed02e2bda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Duli=C3=A7i?= Date: Thu, 18 Aug 2022 19:53:19 +0300 Subject: [PATCH] fixed chart formatter for multiple tables --- app/Abstracts/Report.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/app/Abstracts/Report.php b/app/Abstracts/Report.php index b2643f11a..e45e22a71 100644 --- a/app/Abstracts/Report.php +++ b/app/Abstracts/Report.php @@ -304,8 +304,19 @@ abstract class Report public function setChartLabelFormatter() { - $this->chart['bar']['yaxis']['labels']['formatter'] = $this->getChartLabelFormatter(); - $this->chart['donut']['yaxis']['labels']['formatter'] = $this->getChartLabelFormatter('percent'); + if (count($this->tables) > 1) { + foreach ($this->tables as $table_key => $table) { + if (empty($this->chart[$table_key])) { + continue; + } + + $this->chart[$table_key]['bar']['yaxis']['labels']['formatter'] = $this->getChartLabelFormatter(); + $this->chart[$table_key]['donut']['yaxis']['labels']['formatter'] = $this->getChartLabelFormatter('percent'); + } + } else { + $this->chart['bar']['yaxis']['labels']['formatter'] = $this->getChartLabelFormatter(); + $this->chart['donut']['yaxis']['labels']['formatter'] = $this->getChartLabelFormatter('percent'); + } } public function setYear()