formatting
This commit is contained in:
parent
5797de7473
commit
1466d7b29e
@ -34,41 +34,21 @@ class CashFlow extends Widget
|
||||
{
|
||||
$this->setFilter();
|
||||
|
||||
$labels = $this->getLabels();
|
||||
|
||||
$income = array_values($this->calculateTotals('income'));
|
||||
$expense = array_values($this->calculateTotals('expense'));
|
||||
$profit = array_values($this->calculateProfit($income, $expense));
|
||||
|
||||
$colors = $this->getColors();
|
||||
|
||||
$options = [
|
||||
'chart' => [
|
||||
'stacked' => true,
|
||||
],
|
||||
'plotOptions' => [
|
||||
'bar' => [
|
||||
'columnWidth' => '40%',
|
||||
],
|
||||
],
|
||||
'legend' => [
|
||||
'position' => 'top',
|
||||
],
|
||||
'yaxis' => [
|
||||
'labels' => [
|
||||
'formatter' => $this->getChartLabelFormatter(),
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$chart = new Chart();
|
||||
|
||||
$chart->setType('line')
|
||||
->setOptions($options)
|
||||
->setDefaultLocale($this->getDefaultLocaleOfChart())
|
||||
->setLocales($this->getLocaleTranslationOfChart())
|
||||
->setLabels(array_values($labels))
|
||||
->setColors($colors)
|
||||
->setStacked(true)
|
||||
->setBar(['columnWidth' => '40%'])
|
||||
->setLegendPosition('top')
|
||||
->setYaxisLabels(['formatter' => $this->getChartLabelFormatter()])
|
||||
->setLabels(array_values($this->getLabels()))
|
||||
->setColors($this->getColors())
|
||||
->setDataset(trans('general.incoming'), 'column', $income)
|
||||
->setDataset(trans('general.outgoing'), 'column', $expense)
|
||||
->setDataset(trans_choice('general.profits', 1), 'line', $profit);
|
||||
|
@ -31,39 +31,18 @@ class ProfitLoss extends Widget
|
||||
{
|
||||
$this->setFilter();
|
||||
|
||||
$labels = $this->getLabels();
|
||||
|
||||
$income = $this->getIncome();
|
||||
|
||||
$expense = $this->getExpense();
|
||||
|
||||
$colors = $this->getColors();
|
||||
|
||||
$chart = new Chart();
|
||||
|
||||
$options = [
|
||||
'legend' => [
|
||||
'position' => 'top',
|
||||
'markers' => [
|
||||
'radius' => '12',
|
||||
],
|
||||
],
|
||||
|
||||
'yaxis' => [
|
||||
'labels' => [
|
||||
'formatter' => $this->getChartLabelFormatter(),
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$chart->setType('bar')
|
||||
->setOptions($options)
|
||||
->setDefaultLocale($this->getDefaultLocaleOfChart())
|
||||
->setLocales($this->getLocaleTranslationOfChart())
|
||||
->setLabels(array_values($labels))
|
||||
->setColors($colors)
|
||||
->setDataset(trans_choice('general.incomes', 1), 'column', array_values($income))
|
||||
->setDataset(trans_choice('general.expenses', 1), 'column', array_values($expense));
|
||||
->setLegendPosition('top')
|
||||
->setLegendMarkers(['radius' => '12'])
|
||||
->setYaxisLabels(['formatter' => $this->getChartLabelFormatter()])
|
||||
->setLabels(array_values($this->getLabels()))
|
||||
->setColors($this->getColors())
|
||||
->setDataset(trans_choice('general.incomes', 1), 'column', array_values($this->getIncome()))
|
||||
->setDataset(trans_choice('general.expenses', 1), 'column', array_values($this->getExpense()));
|
||||
|
||||
return $this->view('widgets.bar_chart', [
|
||||
'chart' => $chart,
|
||||
|
Loading…
x
Reference in New Issue
Block a user