Skip to content

Commit

Permalink
fix cs
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Aug 18, 2022
1 parent 0b15108 commit f22275d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Chart.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Chart extends View
['rgba(75, 192, 192, 0.2)', 'rgba(75, 192, 192, 1)'],
['rgba(153, 102, 255, 0.2)', 'rgba(153, 102, 255, 1)'],
['rgba(255, 159, 64, 0.2)', 'rgba(255, 159, 64, 1)'],
['rgba(20, 20, 20, 0.2)', 'rgba(20, 20, 20, 1)']
['rgba(20, 20, 20, 0.2)', 'rgba(20, 20, 20, 1)'],
];

/** @var array Options for chart.js widget */
Expand Down Expand Up @@ -108,15 +108,14 @@ public function setOptions(array $options)
* Example for bar chart with two side-by side bars per category, and one of them stacked:
*
* $chart->setModel($model, ['month', 'turnover_month_shoes', 'turnover_month_shirts', 'turnover_month_trousers', 'turnover_month_total_last_year'], [0,0,0,1]);
*
*/
public function setModel(Model $model, array $columns = [], array $stacks = []): void
{
if (!$columns) {
throw new Exception('Second argument must be specified to Chart::setModel()');
}

$this->dataSets = [];
$this->datasets = [];
$this->stacks = $stacks;

// initialize data-sets
Expand All @@ -140,7 +139,7 @@ public function setModel(Model $model, array $columns = [], array $stacks = []):
];
}

if ($stacks != []) {
if ($stacks !== []) {
$this->setOptions(['scales' => ['yAxes' => [0 => ['stacked' => true]], 'xAxes' => [0 => ['stacked' => true]]]]);
}

Expand Down

0 comments on commit f22275d

Please sign in to comment.