From c5784b0ced51bf98fee43c5aad1ebe43fd5ef2b2 Mon Sep 17 00:00:00 2001 From: asantibanez Date: Tue, 25 Jul 2023 16:28:59 -0500 Subject: [PATCH] Added helper methods for PieChartModel --- README.md | 10 ++++++---- src/Models/PieChartModel.php | 10 ++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 4ea476b..6468d68 100755 --- a/README.md +++ b/README.md @@ -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 diff --git a/src/Models/PieChartModel.php b/src/Models/PieChartModel.php index 489db80..53ac176 100644 --- a/src/Models/PieChartModel.php +++ b/src/Models/PieChartModel.php @@ -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;