Compare commits
3 Commits
master
...
nicko170/m
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e6f04ca4c3 | ||
|
|
a7364ad51c | ||
|
|
47d0f028af |
12136
package-lock.json
generated
12136
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@@ -20,13 +20,14 @@ const pieChart = () => {
|
|||||||
const onSliceClickEventName = component.get('pieChartModel.onSliceClickEventName')
|
const onSliceClickEventName = component.get('pieChartModel.onSliceClickEventName')
|
||||||
const data = component.get('pieChartModel.data')
|
const data = component.get('pieChartModel.data')
|
||||||
const sparkline = component.get('pieChartModel.sparkline')
|
const sparkline = component.get('pieChartModel.sparkline')
|
||||||
|
const type = component.get('pieChartModel.type')
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
series: data.map(item => item.value),
|
series: data.map(item => item.value),
|
||||||
|
|
||||||
chart: {
|
chart: {
|
||||||
height: '100%',
|
height: '100%',
|
||||||
type: 'pie',
|
type: type,
|
||||||
|
|
||||||
...sparkline,
|
...sparkline,
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ class PieChartModel extends BaseChartModel
|
|||||||
|
|
||||||
public $opacity;
|
public $opacity;
|
||||||
|
|
||||||
|
public $type;
|
||||||
|
|
||||||
public $data;
|
public $data;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
@@ -23,6 +25,8 @@ class PieChartModel extends BaseChartModel
|
|||||||
|
|
||||||
$this->opacity = 0.75;
|
$this->opacity = 0.75;
|
||||||
|
|
||||||
|
$this->type = 'pie';
|
||||||
|
|
||||||
$this->data = collect();
|
$this->data = collect();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,6 +37,13 @@ class PieChartModel extends BaseChartModel
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setType($type)
|
||||||
|
{
|
||||||
|
$this->type = $type;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function withOnSliceClickEvent($onSliceClickEventName)
|
public function withOnSliceClickEvent($onSliceClickEventName)
|
||||||
{
|
{
|
||||||
$this->onSliceClickEventName = $onSliceClickEventName;
|
$this->onSliceClickEventName = $onSliceClickEventName;
|
||||||
@@ -57,6 +68,7 @@ class PieChartModel extends BaseChartModel
|
|||||||
return array_merge(parent::toArray(), [
|
return array_merge(parent::toArray(), [
|
||||||
'onSliceClickEventName' => $this->onSliceClickEventName,
|
'onSliceClickEventName' => $this->onSliceClickEventName,
|
||||||
'opacity' => $this->opacity,
|
'opacity' => $this->opacity,
|
||||||
|
'type' => $this->type,
|
||||||
'data' => $this->data->toArray(),
|
'data' => $this->data->toArray(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@@ -69,6 +81,8 @@ class PieChartModel extends BaseChartModel
|
|||||||
|
|
||||||
$this->opacity = data_get($array, 'opacity', 0.75);
|
$this->opacity = data_get($array, 'opacity', 0.75);
|
||||||
|
|
||||||
|
$this->type = data_get($array, 'type', 'pie');
|
||||||
|
|
||||||
$this->data = collect(data_get($array, 'data', []));
|
$this->data = collect(data_get($array, 'data', []));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user