Added support for multi-column stacked charts
This commit is contained in:
@@ -7,6 +7,7 @@ namespace Asantibanez\LivewireCharts\Models;
|
||||
* Class ColumnChartModel
|
||||
* @package Asantibanez\LivewireCharts\Models
|
||||
* @property boolean $isMultiColumn
|
||||
* @property boolean $isStacked
|
||||
*/
|
||||
class ColumnChartModel extends BaseChartModel
|
||||
{
|
||||
@@ -14,6 +15,8 @@ class ColumnChartModel extends BaseChartModel
|
||||
|
||||
public $isMultiColumn;
|
||||
|
||||
public $isStacked;
|
||||
|
||||
public $onColumnClickEventName;
|
||||
|
||||
public $data;
|
||||
@@ -28,6 +31,8 @@ class ColumnChartModel extends BaseChartModel
|
||||
|
||||
$this->isMultiColumn = false;
|
||||
|
||||
$this->isStacked = false;
|
||||
|
||||
$this->data = collect();
|
||||
}
|
||||
|
||||
@@ -45,6 +50,13 @@ class ColumnChartModel extends BaseChartModel
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function stacked()
|
||||
{
|
||||
$this->isStacked = true;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setOpacity($opacity)
|
||||
{
|
||||
$this->opacity = $opacity;
|
||||
@@ -93,6 +105,7 @@ class ColumnChartModel extends BaseChartModel
|
||||
'onColumnClickEventName' => $this->onColumnClickEventName,
|
||||
'opacity' => $this->opacity,
|
||||
'isMultiColumn' => $this->isMultiColumn,
|
||||
'isStacked' => $this->isStacked,
|
||||
'data' => $this->data->toArray(),
|
||||
]);
|
||||
}
|
||||
@@ -107,6 +120,8 @@ class ColumnChartModel extends BaseChartModel
|
||||
|
||||
$this->isMultiColumn = data_get($array, 'isMultiColumn', false);
|
||||
|
||||
$this->isStacked = data_get($array, 'isStacked', false);
|
||||
|
||||
$this->data = collect(data_get($array, 'data', []));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user