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\Document\Document;
use App\Models\Setting\Category;
use App\Traits\Charts;
use App\Traits\DateTime;
use App\Traits\SearchString;
use App\Traits\Translations;
@ -23,7 +24,7 @@ use Illuminate\Support\Str;
abstract class Report
{
use DateTime, SearchString, Translations;
use Charts, DateTime, SearchString, Translations;
public $model;
@ -60,9 +61,19 @@ abstract class Report
'colors' => [
'#6da252',
],
'yaxis' => [
'labels' => [
'formatter' => '',
],
],
],
'donut' => [
//
'yaxis' => [
'labels' => [
'formatter' => '',
],
],
],
];
@ -100,6 +111,7 @@ abstract class Report
$this->setRows();
$this->loadData();
$this->setColumnWidth();
$this->setChartLabelFormatter();
$this->loaded = true;
}
@ -284,6 +296,12 @@ abstract class Report
$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()
{
$this->year = $this->getSearchStringValue('year', Date::now()->year);

View File

@ -55,8 +55,8 @@ class CashFlow extends Widget
'position' => 'top',
],
'yaxis' => [
'labels' => [
'formatter' => $this->getFormatLabel(),
'labels' => [
'formatter' => $this->getFormatLabel(),
],
],
];