Added helper methods for PieChartModel

This commit is contained in:
asantibanez
2023-07-25 16:28:59 -05:00
parent 2d9bcfe480
commit c5784b0ced
2 changed files with 16 additions and 4 deletions

View File

@@ -210,11 +210,13 @@ for each type of chart.
### LivewirePieChart
| Method | Description |
|--------|-------------|
| setOpacity(int $opacity) | Sets slices' opacity |
| Method | Description |
|---------------------------------------------------------------------------|-------------------------------------------------------------------------------------------|
| setOpacity(int $opacity) | Sets slices' opacity |
| asPie() | Displays chart as pie |
| asDonut() | Displays chart as donut |
| addSlice(string $title, double $value, string $color, array $extras = []) | Adds a slice to the chart with the specified color. `$extras` is forwarded on click event |
| withOnSliceClickEvent(string $eventName) | Event Name that will be fired when a column of the chart is clicked |
| withOnSliceClickEvent(string $eventName) | Event Name that will be fired when a column of the chart is clicked |
### LivewireAreaChart

View File

@@ -44,6 +44,16 @@ class PieChartModel extends BaseChartModel
return $this;
}
public function asPie()
{
return $this->setType('pie');
}
public function asDonut()
{
return $this->setType('donut');
}
public function withOnSliceClickEvent($onSliceClickEventName)
{
$this->onSliceClickEventName = $onSliceClickEventName;