label formatter added for Report charts

This commit is contained in:
Burak Civan 2022-06-24 18:54:56 +03:00
parent 0c1ba876cd
commit 4ca4fdba73
2 changed files with 22 additions and 4 deletions

View File

@ -14,6 +14,7 @@ use App\Exports\Common\Reports as Export;
use App\Models\Common\Report as Model; use App\Models\Common\Report as Model;
use App\Models\Document\Document; use App\Models\Document\Document;
use App\Models\Setting\Category; use App\Models\Setting\Category;
use App\Traits\Charts;
use App\Traits\DateTime; use App\Traits\DateTime;
use App\Traits\SearchString; use App\Traits\SearchString;
use App\Traits\Translations; use App\Traits\Translations;
@ -23,7 +24,7 @@ use Illuminate\Support\Str;
abstract class Report abstract class Report
{ {
use DateTime, SearchString, Translations; use Charts, DateTime, SearchString, Translations;
public $model; public $model;
@ -60,9 +61,19 @@ abstract class Report
'colors' => [ 'colors' => [
'#6da252', '#6da252',
], ],
'yaxis' => [
'labels' => [
'formatter' => '',
],
],
], ],
'donut' => [ 'donut' => [
// 'yaxis' => [
'labels' => [
'formatter' => '',
],
],
], ],
]; ];
@ -100,6 +111,7 @@ abstract class Report
$this->setRows(); $this->setRows();
$this->loadData(); $this->loadData();
$this->setColumnWidth(); $this->setColumnWidth();
$this->setChartLabelFormatter();
$this->loaded = true; $this->loaded = true;
} }
@ -284,6 +296,12 @@ abstract class Report
$this->column_name_width = $this->column_value_width = $width; $this->column_name_width = $this->column_value_width = $width;
} }
public function setChartLabelFormatter()
{
$this->chart['bar']['yaxis']['labels']['formatter'] = $this->getFormatLabel();
$this->chart['donut']['yaxis']['labels']['formatter'] = $this->getFormatLabel('percent');
}
public function setYear() public function setYear()
{ {
$this->year = $this->getSearchStringValue('year', Date::now()->year); $this->year = $this->getSearchStringValue('year', Date::now()->year);