diff --git a/.scrutinizer.yml b/.scrutinizer.yml deleted file mode 100644 index 606b2b2..0000000 --- a/.scrutinizer.yml +++ /dev/null @@ -1,19 +0,0 @@ -filter: - excluded_paths: - - tests/* - -checks: - php: - code_rating: true - -tools: - external_code_coverage: true - php_analyzer: true - php_changetracking: true - php_code_sniffer: - config: - standard: "PSR2" - php_cpd: true - php_mess_detector: true - php_pdepend: true - sensiolabs_security_checker: true \ No newline at end of file diff --git a/README.md b/README.md index dc8bb9a..e9c837f 100644 --- a/README.md +++ b/README.md @@ -3,10 +3,11 @@ ![Downloads](https://img.shields.io/packagist/dt/akaunting/laravel-apexcharts) ![Tests](https://img.shields.io/github/workflow/status/akaunting/laravel-apexcharts/Tests?label=tests) [![StyleCI](https://github.styleci.io/repos/452221855/shield?style=flat&branch=master)](https://styleci.io/repos/452221855) -[![Quality](https://img.shields.io/scrutinizer/quality/g/akaunting/laravel-apexcharts?label=quality)](https://scrutinizer-ci.com/g/akaunting/laravel-apexcharts) [![License](https://img.shields.io/github/license/akaunting/laravel-apexcharts)](LICENSE.md) -This package allows you to generate modern and interactive charts using the [ApexCharts](https://apexcharts.com) library directly from Laravel without interacting with JavaScript, CSS, etc. +This package allows you to generate modern and interactive charts using the [ApexCharts](https://apexcharts.com) library directly from `Laravel` without interacting with JavaScript, CSS, etc. + +It covers all of the chart [types](https://apexcharts.com/docs/chart-types/line-chart) and [options](https://apexcharts.com/docs/options/annotations) available within the `ApexChart` library. ## Getting Started @@ -28,14 +29,18 @@ php artisan vendor:publish --tag=apexcharts ### 3. Configure -You can change the column sorting settings of your app from `config/apexcharts.php` file +You can change the chart settings of your app from `config/apexcharts.php` file ## Usage +First of all, create an instance of the `Chart` class and set the data and options according to your needs. + ```php -use Akaunting\Apexcharts\Charts; +use Akaunting\Apexcharts\Chart; -$chart = new Charts(); +... + +$chart = new Chart(); $chart->setType('donut') ->setWidth('100%') @@ -45,28 +50,25 @@ $chart->setType('donut') $chart->setDataset('Name', 'donut', [1907, 1923]); ``` -## Blade +Then, include the JavaScript (on every page using charts). -```php - - - - - - - +```html +... - Apexcharts Sample Donut Chart - + + + ... - - {!! $chart->container() !!} + @apexchartsScripts + +``` + +Finally, call the `container` and `script` method wherever you want to display the chart. - @apexchartsScripts +```php +{!! $chart->container() !!} - {{ $chart->script() }} - - +{!! $chart->script() !!} ``` ## Changelog diff --git a/composer.json b/composer.json index da00654..0591b01 100644 --- a/composer.json +++ b/composer.json @@ -20,10 +20,10 @@ } ], "require": { - "php": ">=7.3", - "illuminate/support": ">=8.0", + "php": ">=8.0", + "ext-json": "*", "balping/json-raw-encoder": "^1.0", - "ext-json": "*" + "illuminate/support": ">=8.0" }, "require-dev": { "phpunit/phpunit": ">=9.0", diff --git a/src/Charts.php b/src/Chart.php similarity index 50% rename from src/Charts.php rename to src/Chart.php index aa64675..7e2d5b6 100644 --- a/src/Charts.php +++ b/src/Chart.php @@ -3,7 +3,7 @@ namespace Akaunting\Apexcharts; use Akaunting\Apexcharts\Options\Annotations; -use Akaunting\Apexcharts\Options\Chart; +use Akaunting\Apexcharts\Options\Chart as ChartOption; use Akaunting\Apexcharts\Options\DataLabels; use Akaunting\Apexcharts\Options\Fill; use Akaunting\Apexcharts\Options\ForecastDataPoints; @@ -25,81 +25,32 @@ use Akaunting\Apexcharts\Traits\Formatter; use Akaunting\Apexcharts\Traits\Types; use Illuminate\Support\Collection; -use Illuminate\Support\Facades\View; +use Illuminate\Support\Facades\View as ViewFacade; +use Illuminate\View\View; -class Charts +class Chart { - use Annotations, Chart, DataLabels, Fill, ForecastDataPoints, Grid, Legend, Markers, NoData, PlotOptions, Responsive, States, Stroke, Subtitle, Theme, Title, Tooltip, Xaxis, Yaxis, Formatter, Types; - - /** - * Stores the chart ID. - * - * @var string - */ - public $id; - - /** - * Stores the chart type. - * - * @var string - */ - public $type = 'line'; - - /** - * Stores the colors options. - * - * @var array - */ - public $colors = []; - - /** - * Stores the labels options. - * - * @var array - */ - public $labels = []; - - /** - * Stores the series options. - * - * @var array - */ - public $series = []; - - /** - * Stores the chart datasets. - * - * @var array - */ - public $datasets = []; - - /** - * Stores the dataset class to be used. - * - * @var object - */ - protected $dataset = DatasetClass::class; - - /** - * Stores the chart options. - * - * @var array - */ - public $options = []; - - /** - * Stores the chart container. - * - * @var string - */ - public $container = 'apexcharts::container'; - - /** - * Stores the available chart letters to create the ID. - * - * @var string - */ - private $chartLetters = 'abcdefghijklmnopqrstuvwxyz'; + use Annotations, ChartOption, DataLabels, Fill, ForecastDataPoints, Grid, Legend, Markers, NoData, PlotOptions, Responsive, States, Stroke, Subtitle, Theme, Title, Tooltip, Xaxis, Yaxis, Formatter, Types; + + public string $id; + + public string $type = 'line'; + + public array $colors = []; + + public array $labels = []; + + public array $series = []; + + public array $datasets = []; + + public string $dataset = DatasetClass::class; + + public array $options = []; + + public string $container = 'apexcharts::container'; + + public string $chartLetters = 'abcdefghijklmnopqrstuvwxyz'; public function __construct() { @@ -108,20 +59,12 @@ public function __construct() $this->options = config('apexcharts.options'); } - /** - * @return false|string - */ - public function getId() + public function getId(): string { return $this->id; } - /** - * - * @param null $type - * @return $this - */ - public function setType($type = null) :Charts + public function setType(string|null $type = null): Chart { $this->type = $type; @@ -134,20 +77,12 @@ public function setType($type = null) :Charts return $this; } - /** - * @return string - */ - public function getType() + public function getType(): string { return $this->type ? $this->type : $this->datasets[0]->type; } - /** - * - * @param string $color - * @return $this - */ - public function setColor($color) :Charts + public function setColor(string $color): Chart { $colors = $this->colors; @@ -156,12 +91,7 @@ public function setColor($color) :Charts return $this->setColors($colors); } - /** - * - * @param array $colors - * @return $this - */ - public function setColors($colors) :Charts + public function setColors(array $colors): Chart { $this->colors = $colors; @@ -172,20 +102,12 @@ public function setColors($colors) :Charts return $this; } - /** - * @return array - */ - public function getColors() + public function getColors(): array { return $this->colors; } - /** - * - * @param array $labels - * @return $this - */ - public function setLabels($labels) :Charts + public function setLabels(array $labels): Chart { $this->labels = $labels; @@ -196,20 +118,12 @@ public function setLabels($labels) :Charts return $this; } - /** - * @return array - */ - public function getLabels() + public function getLabels(): array { return $this->labels; } - /** - * - * @param array $series - * @return $this - */ - public function setSeries($series) :Charts + public function setSeries(array $series): Chart { $this->series = $series; @@ -220,21 +134,12 @@ public function setSeries($series) :Charts return $this; } - /** - * @return array - */ - public function getSeries() + public function getSeries(): array { return $this->series; } - /** - * Adds a new dataset to the chart. - * - * @param string $name - * @param array|Collection $data - */ - public function setDataset(string $name, string $type, $data) + public function setDataset(string $name, string $type, array|Collection $data): Chart { if ($data instanceof Collection) { $data = $data->toArray(); @@ -251,13 +156,7 @@ public function setDataset(string $name, string $type, $data) return $this->setSeries($this->datasets); } - /** - * - * @param array|Collection $options - * - * @return $this - */ - public function setOption($options = []) :Charts + public function setOption(array|Collection $options = []): Chart { if ($options instanceof Collection) { $options = $options->toArray(); @@ -268,13 +167,7 @@ public function setOption($options = []) :Charts return $this; } - /** - * - * @param array|Collection $options - * @param bool $overwrite - * @return $this - */ - public function setOptions($options = [], bool $overwrite = false) :Charts + public function setOptions(array|Collection $options = [], bool $overwrite = false): Chart { if ($options instanceof Collection) { $options = $options->toArray(); @@ -289,31 +182,15 @@ public function setOptions($options = [], bool $overwrite = false) :Charts return $this; } - /** - * Set the chart options. - * - * @param array $options - * - * @return this - */ - public function getOptions() + public function getOptions(): array { - $options = []; - return $this->options; } - /** - * Set the chart container. - * - * @param string $container - * - * @return this - */ - public function container(string $container = null) + public function container(string $container = null): Chart|View { if (! $container) { - return View::make($this->container, ['chart' => $this]); + return ViewFacade::make($this->container, ['chart' => $this]); } $this->container = $container; @@ -321,15 +198,12 @@ public function container(string $container = null) return $this; } - /** - * @return mixed - */ - public function script() + public function script(): View { - return View::make('apexcharts::script', ['chart' => $this]); + return ViewFacade::make('apexcharts::script', ['chart' => $this]); } - public static function loadScript() :string + public static function loadScript(): string { $path = 'https://cdn.jsdelivr.net/npm/apexcharts'; diff --git a/src/Config/apexcharts.php b/src/Config/apexcharts.php index 0a967db..c2a9158 100644 --- a/src/Config/apexcharts.php +++ b/src/Config/apexcharts.php @@ -77,8 +77,8 @@ ], 'stroke' => [ - 'show' => true, - 'width' => 4, + 'show' => true, + 'width' => 4, 'colors' => [ '#008FFB', '#00E396', '#feb019', '#ff455f', '#775dd0', '#80effe', '#0077B5', '#ff6384', '#c9cbcf', '#0057ff', '#00a9f4', '#2ccdc9', '#5e72e4' diff --git a/src/Facade.php b/src/Facade.php index 7337fbb..4412323 100644 --- a/src/Facade.php +++ b/src/Facade.php @@ -9,7 +9,7 @@ class Facade extends BaseFacade /** * Get the registered name of the component. */ - public static function getFacadeAccessor() + public static function getFacadeAccessor(): string { return 'apexcharts'; } diff --git a/src/Options/Annotations.php b/src/Options/Annotations.php index d88cea4..aa63e9a 100644 --- a/src/Options/Annotations.php +++ b/src/Options/Annotations.php @@ -6,56 +6,19 @@ trait Annotations { - /** - * Stores the position of the annotations. - * - * @var string - */ - public $annotationsPosition = ''; - - /** - * Stores the yaxis of the annotations. - * - * @var array - */ - public $annotationsYaxis = []; - - /** - * Stores the xaxis of the annotations. - * - * @var array - */ - public $annotationsXaxis = []; - - /** - * Stores the points of the annotations. - * - * @var array - */ - public $annotationsPoints = []; - - /** - * Stores the texts of the annotations. - * - * @var array - */ - public $annotationsTexts = []; - - /** - * Stores the images of the annotations. - * - * @var array - */ - public $annotationsImages = []; - - /** - * Set the annotations position. - * - * @param string $annotationsPosition - * - * @return this - */ - public function setAnnotationsPosition($annotationsPosition) :Charts + public string $annotationsPosition = ''; + + public array $annotationsYaxis = []; + + public array $annotationsXaxis = []; + + public array $annotationsPoints = []; + + public array $annotationsTexts = []; + + public array $annotationsImages = []; + + public function setAnnotationsPosition(string $annotationsPosition): Chart { $this->annotationsPosition = $annotationsPosition; @@ -68,22 +31,12 @@ public function setAnnotationsPosition($annotationsPosition) :Charts return $this; } - /** - * @return string - */ - public function getAnnotationsPosition() + public function getAnnotationsPosition(): string { return $this->annotationsPosition; } - /** - * Set the annotations yaxis. - * - * @param array $annotationsYaxis - * - * @return this - */ - public function setAnnotationsYaxis($annotationsYaxis) :Charts + public function setAnnotationsYaxis(array $annotationsYaxis): Chart { $this->annotationsYaxis = $annotationsYaxis; @@ -96,22 +49,12 @@ public function setAnnotationsYaxis($annotationsYaxis) :Charts return $this; } - /** - * @return array - */ - public function getAnnotationsYaxis() + public function getAnnotationsYaxis(): array { return $this->annotationsYaxis; } - /** - * Set the annotations xaxis. - * - * @param array $annotationsXaxis - * - * @return this - */ - public function setAnnotationsXaxis($annotationsXaxis) :Charts + public function setAnnotationsXaxis(array $annotationsXaxis): Chart { $this->annotationsXaxis = $annotationsXaxis; @@ -124,22 +67,12 @@ public function setAnnotationsXaxis($annotationsXaxis) :Charts return $this; } - /** - * @return array - */ - public function getAnnotationsXaxis() + public function getAnnotationsXaxis(): array { return $this->annotationsXaxis; } - /** - * Set the annotations points. - * - * @param array $annotationsPoints - * - * @return this - */ - public function setAnnotationsPoints($annotationsPoints) :Charts + public function setAnnotationsPoints(array $annotationsPoints): Chart { $this->annotationsPoints = $annotationsPoints; @@ -152,22 +85,12 @@ public function setAnnotationsPoints($annotationsPoints) :Charts return $this; } - /** - * @return boolean - */ - public function getAnnotationsPoints() + public function getAnnotationsPoints(): array { return $this->annotationsPoints; } - /** - * Set the annotations texts. - * - * @param array $annotationsTexts - * - * @return this - */ - public function setAnnotationsTexts($annotationsTexts) :Charts + public function setAnnotationsTexts(array $annotationsTexts): Chart { $this->annotationsTexts = $annotationsTexts; @@ -180,22 +103,12 @@ public function setAnnotationsTexts($annotationsTexts) :Charts return $this; } - /** - * @return array - */ - public function getAnnotationsTexts() + public function getAnnotationsTexts(): array { return $this->annotationsTexts; } - /** - * Set the annotations images. - * - * @param array $annotationsImages - * - * @return this - */ - public function setAnnotationsImages($annotationsImages) :Charts + public function setAnnotationsImages(array $annotationsImages): Chart { $this->annotationsImages = $annotationsImages; @@ -208,10 +121,7 @@ public function setAnnotationsImages($annotationsImages) :Charts return $this; } - /** - * @return array - */ - public function getAnnotationsImages() + public function getAnnotationsImages(): array { return $this->annotationsImages; } diff --git a/src/Options/Chart.php b/src/Options/Chart.php index dc3f7df..c6511ea 100644 --- a/src/Options/Chart.php +++ b/src/Options/Chart.php @@ -6,175 +6,53 @@ trait Chart { - /** - * Stores the animations of the chart. - * - * @var array - */ - public $animations = []; - - /** - * Stores the animations of the chart. - * - * @var string - */ - public $background = '#fff'; - - /** - * Stores the animations of the chart. - * - * @var array - */ - public $brush = []; - - /** - * Stores the defaultLocale of the chart. - * - * @var string - */ - public $defaultLocale = 'en'; - - /** - * Stores the dropShadow of the chart. - * - * @var array - */ - public $dropShadow = []; - - /** - * Stores the fontFamily of the chart. - * - * @var string - */ - public $fontFamily = ''; - - /** - * Stores the foreColor of the chart. - * - * @var string - */ - public $foreColor = ''; - - /** - * Stores the group of the chart. - * - * @var string - */ - public $group = ''; - - /** - * Stores the events of the chart. - * - * @var array - */ - public $events = []; - - /** - * Stores the height of the chart. - * - * @var int - */ - public $height = 400; - - /** - * Stores the locales of the chart. - * - * @var array - */ - public $locales = []; - - /** - * Stores the offsetX of the chart. - * - * @var int - */ - public $offsetX = 0; - - /** - * Stores the offsetY of the chart. - * - * @var int - */ - public $offsetY = 0; - - /** - * Stores the parentHeightOffset of the chart. - * - * @var int - */ - public $parentHeightOffset = 15; - - /** - * Stores the redrawOnParentResize of the chart. - * - * @var booelan - */ - public $redrawOnParentResize = true; - - /** - * Stores the redrawOnWindowResize of the chart. - * - * @var booelan - */ - public $redrawOnWindowResize = true; - - /** - * Stores the selection of the chart. - * - * @var array - */ - public $selection = []; - - /** - * Stores the sparkline of the chart. - * - * @var array - */ - public $sparkline = []; - - /** - * Stores the stacked of the chart. - * - * @var string - */ - public $stacked = false; - - /** - * Stores the stackType of the chart. - * - * @var string - */ - public $stackType = 'normal'; - - /** - * Stores the toolbar options. - * - * @var array - */ - public $toolbar = []; - - /** - * Stores the width of the chart. - * - * @var int|string - */ - public $width = null; - - /** - * Stores the zoom options. - * - * @var array - */ - public $zoom = []; - - /** - * Set the chart animations. - * - * @param array $animations - * - * @return this - */ - public function setAnimations(int $animations) :Charts + public array $animations = []; + + public string $background = '#fff'; + + public array $brush = []; + + public string $defaultLocale = 'en'; + + public array $dropShadow = []; + + public string $fontFamily = ''; + + public string $foreColor = ''; + + public string $group = ''; + + public array $events = []; + + public int|string|null $height = 400; + + public array $locales = []; + + public int $offsetX = 0; + + public int $offsetY = 0; + + public int $parentHeightOffset = 15; + + public bool $redrawOnParentResize = true; + + public bool $redrawOnWindowResize = true; + + public array $selection = []; + + public array $sparkline = []; + + public bool $stacked = false; + + public string $stackType = 'normal'; + + public array $toolbar = []; + + public int|string|null $width = null; + + public array $zoom = []; + + public function setAnimations(array $animations): Chart { $this->animations = $animations; @@ -187,22 +65,12 @@ public function setAnimations(int $animations) :Charts return $this; } - /** - * @return array - */ - public function getAnimations() + public function getAnimations(): array { return $this->animations; } - /** - * Set the chart background. - * - * @param array $background - * - * @return this - */ - public function setBackground(string $background) :Charts + public function setBackground(string $background): Chart { $this->background = $background; @@ -215,22 +83,12 @@ public function setBackground(string $background) :Charts return $this; } - /** - * @return string - */ - public function getBackground() + public function getBackground(): string { return $this->background; } - /** - * Set the chart brush. - * - * @param array $brush - * - * @return this - */ - public function setBrush($brush) :Charts + public function setBrush(array $brush): Chart { $this->brush = $brush; @@ -243,22 +101,12 @@ public function setBrush($brush) :Charts return $this; } - /** - * @return string - */ - public function getBrush() + public function getBrush(): array { return $this->brush; } - /** - * Set the chart defaultLocale. - * - * @param array $defaultLocale - * - * @return this - */ - public function setDefaultLocale($defaultLocale) :Charts + public function setDefaultLocale(string $defaultLocale): Chart { $this->defaultLocale = $defaultLocale; @@ -271,22 +119,12 @@ public function setDefaultLocale($defaultLocale) :Charts return $this; } - /** - * @return string - */ - public function getDefaultLocale() + public function getDefaultLocale(): string { return $this->defaultLocale; } - /** - * Set the chart dropShadow. - * - * @param array $dropShadow - * - * @return this - */ - public function setDropShadow($dropShadow) :Charts + public function setDropShadow(array $dropShadow): Chart { $this->dropShadow = $dropShadow; @@ -299,22 +137,12 @@ public function setDropShadow($dropShadow) :Charts return $this; } - /** - * @return string - */ - public function getDropShadow() + public function getDropShadow(): array { return $this->dropShadow; } - /** - * Set the chart fontFamily. - * - * @param string $fontFamily - * - * @return this - */ - public function setFontFamily(string $fontFamily) :Charts + public function setFontFamily(string $fontFamily): Chart { $this->fontFamily = $fontFamily; @@ -327,22 +155,12 @@ public function setFontFamily(string $fontFamily) :Charts return $this; } - /** - * @return string - */ - public function getFontFamily() + public function getFontFamily(): string { return $this->fontFamily; } - /** - * Set the chart foreColor. - * - * @param string $foreColor - * - * @return this - */ - public function setForeColor(string $foreColor) :Charts + public function setForeColor(string $foreColor): Chart { $this->foreColor = $foreColor; @@ -355,22 +173,12 @@ public function setForeColor(string $foreColor) :Charts return $this; } - /** - * @return string - */ - public function getForeColor() + public function getForeColor(): string { return $this->foreColor; } - /** - * Set the chart group. - * - * @param int $group - * - * @return this - */ - public function setGroup(int $group) :Charts + public function setGroup(string $group): Chart { $this->group = $group; @@ -383,22 +191,12 @@ public function setGroup(int $group) :Charts return $this; } - /** - * @return int - */ - public function getGroup() + public function getGroup(): string { return $this->group; } - /** - * Set the chart events. - * - * @param int $events - * - * @return this - */ - public function setEvents(int $events) :Charts + public function setEvents(array $events): Chart { $this->events = $events; @@ -411,22 +209,12 @@ public function setEvents(int $events) :Charts return $this; } - /** - * @return int - */ - public function getEvents() + public function getEvents(): array { return $this->events; } - /** - * Set the chart height. - * - * @param int $height - * - * @return this - */ - public function setHeight(int $height) :Charts + public function setHeight(int|string|null $height): Chart { $this->height = $height; @@ -439,22 +227,12 @@ public function setHeight(int $height) :Charts return $this; } - /** - * @return int - */ - public function getHeight() + public function getHeight(): int|string|null { return $this->height; } - /** - * Set the chart locales. - * - * @param array $locales - * - * @return this - */ - public function setLocales($locales) :Charts + public function setLocales(array $locales): Chart { $this->locales = $locales; @@ -467,22 +245,12 @@ public function setLocales($locales) :Charts return $this; } - /** - * @return array - */ - public function getLocales() + public function getLocales(): array { return $this->locales; } - /** - * Set the chart offsetX. - * - * @param int $offsetX - * - * @return this - */ - public function setOffsetX(int $offsetX) :Charts + public function setOffsetX(int $offsetX): Chart { $this->offsetX = $offsetX; @@ -495,22 +263,12 @@ public function setOffsetX(int $offsetX) :Charts return $this; } - /** - * @return int - */ - public function getOffsetX() + public function getOffsetX(): int { return $this->offsetX; } - /** - * Set the chart offsetY. - * - * @param int $offsetY - * - * @return this - */ - public function setOffsetY(int $offsetY) :Charts + public function setOffsetY(int $offsetY): Chart { $this->offsetY = $offsetY; @@ -523,22 +281,12 @@ public function setOffsetY(int $offsetY) :Charts return $this; } - /** - * @return int - */ - public function getOffsetY() + public function getOffsetY(): int { return $this->offsetY; } - /** - * Set the chart parentHeightOffset. - * - * @param string $parentHeightOffset - * - * @return this - */ - public function setParentHeightOffset(int $parentHeightOffset) :Charts + public function setParentHeightOffset(int $parentHeightOffset): Chart { $this->parentHeightOffset = $parentHeightOffset; @@ -551,22 +299,12 @@ public function setParentHeightOffset(int $parentHeightOffset) :Charts return $this; } - /** - * @return int - */ - public function getParentHeightOffset() + public function getParentHeightOffset(): int { return $this->parentHeightOffset; } - /** - * Set the chart redrawOnParentResize. - * - * @param boolean $redrawOnParentResize - * - * @return this - */ - public function setRedrawOnParentResize($redrawOnParentResize) :Charts + public function setRedrawOnParentResize(bool $redrawOnParentResize): Chart { $this->redrawOnParentResize = $redrawOnParentResize; @@ -579,22 +317,12 @@ public function setRedrawOnParentResize($redrawOnParentResize) :Charts return $this; } - /** - * @return boolean - */ - public function getRedrawOnParentResize() + public function getRedrawOnParentResize(): bool { return $this->redrawOnParentResize; } - /** - * Set the chart redrawOnWindowResize. - * - * @param string $redrawOnWindowResize - * - * @return this - */ - public function setRedrawOnWindowResize($redrawOnWindowResize) :Charts + public function setRedrawOnWindowResize(bool $redrawOnWindowResize): Chart { $this->redrawOnWindowResize = $redrawOnWindowResize; @@ -607,22 +335,12 @@ public function setRedrawOnWindowResize($redrawOnWindowResize) :Charts return $this; } - /** - * @return int - */ - public function getRedrawOnWindowResize() + public function getRedrawOnWindowResize(): bool { return $this->redrawOnWindowResize; } - /** - * Set the chart selection. - * - * @param string $selection - * - * @return this - */ - public function setSelection($selection) :Charts + public function setSelection(array $selection): Chart { $this->selection = $selection; @@ -635,22 +353,12 @@ public function setSelection($selection) :Charts return $this; } - /** - * @return int - */ - public function getSelection() + public function getSelection(): array { return $this->selection; } - /** - * Set the chart sparkline. - * - * @param string $sparkline - * - * @return this - */ - public function setSparkline($sparkline) :Charts + public function setSparkline(array $sparkline): Chart { $this->sparkline = $sparkline; @@ -663,22 +371,12 @@ public function setSparkline($sparkline) :Charts return $this; } - /** - * @return int - */ - public function getSparkline() + public function getSparkline(): array { return $this->sparkline; } - /** - * Set the chart stacked. - * - * @param string $stacked - * - * @return this - */ - public function setStacked(string $stacked) :Charts + public function setStacked(bool $stacked): Chart { $this->stacked = $stacked; @@ -691,22 +389,12 @@ public function setStacked(string $stacked) :Charts return $this; } - /** - * @return int - */ - public function getStacked() + public function getStacked(): bool { return $this->stacked; } - /** - * Set the chart stackType. - * - * @param string $stackType - * - * @return this - */ - public function setStackType(string $stackType) :Charts + public function setStackType(string $stackType): Chart { $this->stackType = $stackType; @@ -719,22 +407,12 @@ public function setStackType(string $stackType) :Charts return $this; } - /** - * @return string - */ - public function getStackType() + public function getStackType(): string { return $this->stackType; } - /** - * Set the chart width. - * - * @param array $toolbar - * - * @return this - */ - public function setToolbar(array $toolbar) :Charts + public function setToolbar(array $toolbar): Chart { $this->toolbar = $toolbar; @@ -747,22 +425,12 @@ public function setToolbar(array $toolbar) :Charts return $this; } - /** - * @return array - */ - public function getToolbar() + public function getToolbar(): array { return $this->toolbar; } - /** - * Set the chart width. - * - * @param int|string $width - * - * @return this - */ - public function setWidth($width) :Charts + public function setWidth(int|string|null $width): Chart { $this->width = $width; @@ -775,22 +443,12 @@ public function setWidth($width) :Charts return $this; } - /** - * @return int - */ - public function getWidth() + public function getWidth(): int|string|null { return $this->width; } - /** - * Set the chart width. - * - * @param array $zoom - * - * @return this - */ - public function setZoom(array $zoom) :Charts + public function setZoom(array $zoom): Chart { $this->zoom = $zoom; @@ -803,10 +461,7 @@ public function setZoom(array $zoom) :Charts return $this; } - /** - * @return array - */ - public function getZoom() + public function getZoom(): array { return $this->zoom; } diff --git a/src/Options/DataLabels.php b/src/Options/DataLabels.php index e6b951b..c7ea2ec 100644 --- a/src/Options/DataLabels.php +++ b/src/Options/DataLabels.php @@ -6,84 +6,27 @@ trait DataLabels { - /** - * Stores the enabled of the dataLabels. - * - * @var boolean - */ - public $dataLabelsEnabled = true; - - /** - * Stores the enabledOnSeries of the dataLabels. - * - * @var array|int - */ - public $dataLabelsEnabledOnSeries; - - /** - * Stores the formatter of the dataLabels. - * - * @var function - */ - public $dataLabelsFormatter; - - /** - * Stores the textAnchor of the dataLabels. - * - * @var string - */ - public $dataLabelsTextAnchor = 'middle'; - - /** - * Stores the distributed of the dataLabels. - * - * @var boolean - */ - public $dataLabelsDistributed = false; - - /** - * Stores the offsetX of the dataLabels. - * - * @var int - */ - public $dataLabelsOffsetX = 0; - - /** - * Stores the offsetY of the dataLabels. - * - * @var int - */ - public $dataLabelsOffsetY = 0; - - /** - * Stores the style of the dataLabels. - * - * @var array - */ - public $dataLabelsStyle = []; - - /** - * Stores the background of the dataLabels. - * - * @var array - */ - public $dataLabelsBackground = []; - - /** - * Stores the dropShadow of the dataLabels. - * - * @var array - */ - public $dataLabelsDropShadow = []; - - /** - * Set the dataLabels show. - * - * @param string $dataLabelsEnabled - * - * @return this - */ - public function setDataLabelsEnabled($dataLabelsEnabled) :Charts + public bool $dataLabelsEnabled = true; + + public array $dataLabelsEnabledOnSeries; + + public mixed $dataLabelsFormatter; + + public string $dataLabelsTextAnchor = 'middle'; + + public bool $dataLabelsDistributed = false; + + public int $dataLabelsOffsetX = 0; + + public int $dataLabelsOffsetY = 0; + + public array $dataLabelsStyle = []; + + public array $dataLabelsBackground = []; + + public array $dataLabelsDropShadow = []; + + public function setDataLabelsEnabled(bool $dataLabelsEnabled): Chart { $this->dataLabelsEnabled = $dataLabelsEnabled; @@ -96,22 +39,12 @@ public function setDataLabelsEnabled($dataLabelsEnabled) :Charts return $this; } - /** - * @return boolean - */ - public function getDataLabelsEnabled() + public function getDataLabelsEnabled(): bool { return $this->dataLabelsEnabled; } - /** - * Set the dataLabels enabledOnSeries. - * - * @param array|int $dataLabelsEnabledOnSeries - * - * @return this - */ - public function setDataLabelsEnabledOnSeries($dataLabelsEnabledOnSeries) :Charts + public function setDataLabelsEnabledOnSeries(array $dataLabelsEnabledOnSeries): Chart { $this->dataLabelsEnabledOnSeries = $dataLabelsEnabledOnSeries; @@ -124,22 +57,12 @@ public function setDataLabelsEnabledOnSeries($dataLabelsEnabledOnSeries) :Charts return $this; } - /** - * @return array|int - */ - public function getDataLabelsEnabledOnSeries() + public function getDataLabelsEnabledOnSeries(): array { return $this->dataLabelsEnabledOnSeries; } - /** - * Set the dataLabels formatter. - * - * @param function $dataLabelsFormatter - * - * @return this - */ - public function setDataLabelsFormatter($dataLabelsFormatter) :Charts + public function setDataLabelsFormatter(mixed $dataLabelsFormatter): Chart { $this->dataLabelsFormatter = $dataLabelsFormatter; @@ -152,22 +75,12 @@ public function setDataLabelsFormatter($dataLabelsFormatter) :Charts return $this; } - /** - * @return function - */ - public function getDataLabelsFormatter() + public function getDataLabelsFormatter(): mixed { return $this->dataLabelsFormatter; } - /** - * Set the dataLabels textAnchor. - * - * @param string $dataLabelsTextAnchor - * - * @return this - */ - public function setDataLabelsTextAnchor($dataLabelsTextAnchor) :Charts + public function setDataLabelsTextAnchor(string $dataLabelsTextAnchor): Chart { $this->dataLabelsTextAnchor = $dataLabelsTextAnchor; @@ -180,22 +93,12 @@ public function setDataLabelsTextAnchor($dataLabelsTextAnchor) :Charts return $this; } - /** - * @return string - */ - public function getDataLabelsTextAnchor() + public function getDataLabelsTextAnchor(): string { return $this->dataLabelsTextAnchor; } - /** - * Set the dataLabels distributed. - * - * @param boolean $dataLabelsDistributed - * - * @return this - */ - public function setDataLabelsDistributed($dataLabelsDistributed) :Charts + public function setDataLabelsDistributed(bool $dataLabelsDistributed): Chart { $this->dataLabelsDistributed = $dataLabelsDistributed; @@ -208,22 +111,12 @@ public function setDataLabelsDistributed($dataLabelsDistributed) :Charts return $this; } - /** - * @return boolean - */ - public function getDataLabelsDistributed() + public function getDataLabelsDistributed(): bool { return $this->dataLabelsDistributed; } - /** - * Set the dataLabels offsetX. - * - * @param int $dataLabelsOffsetX - * - * @return this - */ - public function setDataLabelsOffsetX($dataLabelsOffsetX) :Charts + public function setDataLabelsOffsetX(int $dataLabelsOffsetX): Chart { $this->dataLabelsOffsetX = $dataLabelsOffsetX; @@ -236,22 +129,12 @@ public function setDataLabelsOffsetX($dataLabelsOffsetX) :Charts return $this; } - /** - * @return boolean - */ - public function getDataLabelsOffsetX() + public function getDataLabelsOffsetX(): int { return $this->dataLabelsOffsetX; } - /** - * Set the dataLabels offsetY. - * - * @param int $dataLabelsOffsetY - * - * @return this - */ - public function setDataLabelsOffsetY($dataLabelsOffsetY) :Charts + public function setDataLabelsOffsetY(int $dataLabelsOffsetY): Chart { $this->dataLabelsOffsetY = $dataLabelsOffsetY; @@ -264,22 +147,12 @@ public function setDataLabelsOffsetY($dataLabelsOffsetY) :Charts return $this; } - /** - * @return int - */ - public function getDataLabelsOffsetY() + public function getDataLabelsOffsetY(): int { return $this->dataLabelsOffsetY; } - /** - * Set the dataLabels style. - * - * @param array $dataLabelsStyle - * - * @return this - */ - public function setDataLabelsStyle($dataLabelsStyle) :Charts + public function setDataLabelsStyle(array $dataLabelsStyle): Chart { $this->dataLabelsStyle = $dataLabelsStyle; @@ -292,22 +165,12 @@ public function setDataLabelsStyle($dataLabelsStyle) :Charts return $this; } - /** - * @return array - */ - public function getDataLabelsStyle() + public function getDataLabelsStyle(): array { return $this->dataLabelsStyle; } - /** - * Set the dataLabels background. - * - * @param array $dataLabelsBackground - * - * @return this - */ - public function setDataLabelsBackground($dataLabelsBackground) :Charts + public function setDataLabelsBackground(array $dataLabelsBackground): Chart { $this->dataLabelsBackground = $dataLabelsBackground; @@ -320,22 +183,12 @@ public function setDataLabelsBackground($dataLabelsBackground) :Charts return $this; } - /** - * @return array - */ - public function getDataLabelsBackground() + public function getDataLabelsBackground(): array { return $this->dataLabelsBackground; } - /** - * Set the dataLabels dropShadow. - * - * @param string $dataLabelsDropShadow - * - * @return this - */ - public function setDataLabelsDropShadow($dataLabelsDropShadow) :Charts + public function setDataLabelsDropShadow(array $dataLabelsDropShadow): Chart { $this->dataLabelsDropShadow = $dataLabelsDropShadow; @@ -348,10 +201,7 @@ public function setDataLabelsDropShadow($dataLabelsDropShadow) :Charts return $this; } - /** - * @return boolean - */ - public function getDataLabelsDropShadow() + public function getDataLabelsDropShadow(): array { return $this->dataLabelsDropShadow; } diff --git a/src/Options/Fill.php b/src/Options/Fill.php index a81d6e8..3888f17 100644 --- a/src/Options/Fill.php +++ b/src/Options/Fill.php @@ -6,56 +6,19 @@ trait Fill { - /** - * Stores the colors of the fill. - * - * @var array - */ - public $fillColors = []; - - /** - * Stores the opacity of the fill. - * - * @var int - */ - public $fillOpacity = 0.9; - - /** - * Stores the type of the fill. - * - * @var string - */ - public $fillType = 'solid'; - - /** - * Stores the gradient of the fill. - * - * @var array - */ - public $fillGradient = []; - - /** - * Stores the image of the fill. - * - * @var array - */ - public $fillImage = []; - - /** - * Stores the pattern of the fill. - * - * @var array - */ - public $fillPattern = []; - - /** - * Set the fill colors. - * - * @param array $fillColors - * - * @return this - */ - public function setFillColors($fillColors) :Charts + public array $fillColors = []; + + public int|float $fillOpacity = 0.9; + + public string $fillType = 'solid'; + + public array $fillGradient = []; + + public array $fillImage = []; + + public array $fillPattern = []; + + public function setFillColors(array $fillColors): Chart { $this->fillColors = $fillColors; @@ -68,22 +31,12 @@ public function setFillColors($fillColors) :Charts return $this; } - /** - * @return array - */ - public function getFillColors() + public function getFillColors(): array { return $this->fillColors; } - /** - * Set the fill opacity. - * - * @param array $fillOpacity - * - * @return this - */ - public function setFillOpacity($fillOpacity) :Charts + public function setFillOpacity(int|float $fillOpacity): Chart { $this->fillOpacity = $fillOpacity; @@ -96,22 +49,12 @@ public function setFillOpacity($fillOpacity) :Charts return $this; } - /** - * @return array - */ - public function getFillOpacity() + public function getFillOpacity(): int|float { return $this->fillOpacity; } - /** - * Set the fill type. - * - * @param string $fillType - * - * @return this - */ - public function setFillType($fillType) :Charts + public function setFillType(string $fillType): Chart { $this->fillType = $fillType; @@ -124,22 +67,12 @@ public function setFillType($fillType) :Charts return $this; } - /** - * @return string - */ - public function getFillType() + public function getFillType(): string { return $this->fillType; } - /** - * Set the fill gradient. - * - * @param array $fillGradient - * - * @return this - */ - public function setFillGradient($fillGradient) :Charts + public function setFillGradient(array $fillGradient): Chart { $this->fillGradient = $fillGradient; @@ -152,22 +85,12 @@ public function setFillGradient($fillGradient) :Charts return $this; } - /** - * @return array - */ - public function getFillGradient() + public function getFillGradient(): array { return $this->fillGradient; } - /** - * Set the fill image. - * - * @param array $fillImage - * - * @return this - */ - public function setFillImage($fillImage) :Charts + public function setFillImage(array $fillImage): Chart { $this->fillImage = $fillImage; @@ -180,22 +103,12 @@ public function setFillImage($fillImage) :Charts return $this; } - /** - * @return array - */ - public function getFillImage() + public function getFillImage(): array { return $this->fillImage; } - /** - * Set the fill pattern. - * - * @param array $fillPattern - * - * @return this - */ - public function setFillPattern($fillPattern) :Charts + public function setFillPattern(array $fillPattern): Chart { $this->fillPattern = $fillPattern; @@ -208,10 +121,7 @@ public function setFillPattern($fillPattern) :Charts return $this; } - /** - * @return array - */ - public function getFillPattern() + public function getFillPattern(): array { return $this->fillPattern; } diff --git a/src/Options/ForecastDataPoints.php b/src/Options/ForecastDataPoints.php index 714729e..c5b03c0 100644 --- a/src/Options/ForecastDataPoints.php +++ b/src/Options/ForecastDataPoints.php @@ -6,42 +6,15 @@ trait ForecastDataPoints { - /** - * Stores the count of the forecastDataPoints. - * - * @var int - */ - public $forecastDataPointsCount = 0; - - /** - * Stores the fillOpacity of the forecastDataPoints. - * - * @var int - */ - public $forecastDataPointsFillOpacity = 0.5; - - /** - * Stores the strokeWidth of the forecastDataPoints. - * - * @var int - */ - public $forecastDataPointsStrokeWidth; - - /** - * Stores the dashArray of the forecastDataPoints. - * - * @var int - */ - public $forecastDataPointsDashArray = 4; - - /** - * Set the forecastDataPoints count. - * - * @param int $forecastDataPointsCount - * - * @return this - */ - public function setForecastDataPointsCount($forecastDataPointsCount) :Charts + public int $forecastDataPointsCount = 0; + + public int|float $forecastDataPointsFillOpacity = 0.5; + + public int $forecastDataPointsStrokeWidth; + + public int $forecastDataPointsDashArray = 4; + + public function setForecastDataPointsCount(int $forecastDataPointsCount): Chart { $this->forecastDataPointsCount = $forecastDataPointsCount; @@ -54,22 +27,12 @@ public function setForecastDataPointsCount($forecastDataPointsCount) :Charts return $this; } - /** - * @return int - */ - public function getForecastDataPointsCount() + public function getForecastDataPointsCount(): int { return $this->forecastDataPointsCount; } - /** - * Set the forecastDataPoints fillOpacity. - * - * @param int $forecastDataPointsFillOpacity - * - * @return this - */ - public function setForecastDataPointsFillOpacity($forecastDataPointsFillOpacity) :Charts + public function setForecastDataPointsFillOpacity(int|float $forecastDataPointsFillOpacity): Chart { $this->forecastDataPointsFillOpacity = $forecastDataPointsFillOpacity; @@ -82,22 +45,12 @@ public function setForecastDataPointsFillOpacity($forecastDataPointsFillOpacity) return $this; } - /** - * @return int - */ - public function getForecastDataPointsFillOpacity() + public function getForecastDataPointsFillOpacity(): int|float { return $this->forecastDataPointsFillOpacity; } - /** - * Set the forecastDataPoints strokeWidth. - * - * @param int $forecastDataPointsStrokeWidth - * - * @return this - */ - public function setForecastDataPointsStrokeWidth($forecastDataPointsStrokeWidth) :Charts + public function setForecastDataPointsStrokeWidth(int $forecastDataPointsStrokeWidth): Chart { $this->forecastDataPointsStrokeWidth = $forecastDataPointsStrokeWidth; @@ -110,22 +63,12 @@ public function setForecastDataPointsStrokeWidth($forecastDataPointsStrokeWidth) return $this; } - /** - * @return int - */ - public function getForecastDataPointsStrokeWidth() + public function getForecastDataPointsStrokeWidth(): int { return $this->forecastDataPointsStrokeWidth; } - /** - * Set the forecastDataPoints dashArray. - * - * @param int $forecastDataPointsDashArray - * - * @return this - */ - public function setForecastDataPointsDashArray($forecastDataPointsDashArray) :Charts + public function setForecastDataPointsDashArray(int $forecastDataPointsDashArray): Chart { $this->forecastDataPointsDashArray = $forecastDataPointsDashArray; @@ -138,10 +81,7 @@ public function setForecastDataPointsDashArray($forecastDataPointsDashArray) :Ch return $this; } - /** - * @return int - */ - public function getForecastDataPointsDashArray() + public function getForecastDataPointsDashArray(): int { return $this->forecastDataPointsDashArray; } diff --git a/src/Options/Grid.php b/src/Options/Grid.php index 79295c7..de1a53f 100644 --- a/src/Options/Grid.php +++ b/src/Options/Grid.php @@ -6,77 +6,25 @@ trait Grid { - /** - * Stores the show of the grid. - * - * @var boolean - */ - public $gridShow = true; - - /** - * Stores the borderColor of the grid. - * - * @var string - */ - public $gridBorderColor = '#90A4AE'; - - /** - * Stores the strokeDashArray of the grid. - * - * @var int - */ - public $gridStrokeDashArray = 0; - - /** - * Stores the position of the grid. - * - * @var string - */ - public $gridPosition = 'back'; - - /** - * Stores the xaxis of the grid. - * - * @var array - */ - public $gridXaxis = []; - - /** - * Stores the yaxis of the grid. - * - * @var array - */ - public $gridYaxis = []; - - /** - * Stores the row of the grid. - * - * @var array - */ - public $gridRow = []; - - /** - * Stores the column of the grid. - * - * @var array - */ - public $gridColumn = []; - - /** - * Stores the padding of the grid. - * - * @var array - */ - public $gridPadding = []; - - /** - * Set the grid show. - * - * @param string $gridShow - * - * @return this - */ - public function setGridShow($gridShow) :Charts + public bool $gridShow = true; + + public string $gridBorderColor = '#90A4AE'; + + public int $gridStrokeDashArray = 0; + + public string $gridPosition = 'back'; + + public array $gridXaxis = []; + + public array $gridYaxis = []; + + public array $gridRow = []; + + public array $gridColumn = []; + + public array $gridPadding = []; + + public function setGridShow(bool $gridShow): Chart { $this->gridShow = $gridShow; @@ -89,22 +37,12 @@ public function setGridShow($gridShow) :Charts return $this; } - /** - * @return boolean - */ - public function getGridShow() + public function getGridShow(): bool { return $this->gridShow; } - /** - * Set the grid borderColor. - * - * @param string $gridBorderColor - * - * @return this - */ - public function setGridBorderColor($gridBorderColor) :Charts + public function setGridBorderColor(string $gridBorderColor): Chart { $this->gridBorderColor = $gridBorderColor; @@ -117,22 +55,12 @@ public function setGridBorderColor($gridBorderColor) :Charts return $this; } - /** - * @return string - */ - public function getGridBorderColor() + public function getGridBorderColor(): string { return $this->gridBorderColor; } - /** - * Set the grid strokeDashArray. - * - * @param int $gridStrokeDashArray - * - * @return this - */ - public function setGridStrokeDashArray($gridStrokeDashArray) :Charts + public function setGridStrokeDashArray(int $gridStrokeDashArray): Chart { $this->gridStrokeDashArray = $gridStrokeDashArray; @@ -145,22 +73,12 @@ public function setGridStrokeDashArray($gridStrokeDashArray) :Charts return $this; } - /** - * @return int - */ - public function getGridStrokeDashArray() + public function getGridStrokeDashArray(): int { return $this->gridStrokeDashArray; } - /** - * Set the grid position. - * - * @param string $gridPosition - * - * @return this - */ - public function setGridPosition($gridPosition) :Charts + public function setGridPosition(string $gridPosition): Chart { $this->gridPosition = $gridPosition; @@ -173,22 +91,12 @@ public function setGridPosition($gridPosition) :Charts return $this; } - /** - * @return string - */ - public function getGridPosition() + public function getGridPosition(): string { return $this->gridPosition; } - /** - * Set the grid xaxis. - * - * @param array $gridXaxis - * - * @return this - */ - public function setGridXaxis($gridXaxis) :Charts + public function setGridXaxis(array $gridXaxis): Chart { $this->gridXaxis = $gridXaxis; @@ -201,22 +109,12 @@ public function setGridXaxis($gridXaxis) :Charts return $this; } - /** - * @return array - */ - public function getGridXaxis() + public function getGridXaxis(): array { return $this->gridXaxis; } - /** - * Set the grid yaxis. - * - * @param array $gridYaxis - * - * @return this - */ - public function setGridYaxis($gridYaxis) :Charts + public function setGridYaxis(array $gridYaxis): Chart { $this->gridYaxis = $gridYaxis; @@ -229,22 +127,12 @@ public function setGridYaxis($gridYaxis) :Charts return $this; } - /** - * @return array - */ - public function getGridYaxis() + public function getGridYaxis(): array { return $this->gridYaxis; } - /** - * Set the grid row. - * - * @param array $gridRow - * - * @return this - */ - public function setGridRow($gridRow) :Charts + public function setGridRow(array $gridRow): Chart { $this->gridRow = $gridRow; @@ -257,22 +145,12 @@ public function setGridRow($gridRow) :Charts return $this; } - /** - * @return array - */ - public function getGridRow() + public function getGridRow():array { return $this->gridRow; } - /** - * Set the grid column. - * - * @param array $gridColumn - * - * @return this - */ - public function setGridColumn($gridColumn) :Charts + public function setGridColumn(array $gridColumn): Chart { $this->gridColumn = $gridColumn; @@ -285,22 +163,12 @@ public function setGridColumn($gridColumn) :Charts return $this; } - /** - * @return array - */ - public function getGridColumn() + public function getGridColumn(): array { return $this->gridColumn; } - /** - * Set the grid padding. - * - * @param array $gridPadding - * - * @return this - */ - public function setGridPadding($gridPadding) :Charts + public function setGridPadding(array $gridPadding): Chart { $this->gridPadding = $gridPadding; @@ -313,10 +181,7 @@ public function setGridPadding($gridPadding) :Charts return $this; } - /** - * @return array - */ - public function getGridPadding() + public function getGridPadding(): array { return $this->gridPadding; } diff --git a/src/Options/Legend.php b/src/Options/Legend.php index 03546e4..87f9a5c 100644 --- a/src/Options/Legend.php +++ b/src/Options/Legend.php @@ -6,175 +6,53 @@ trait Legend { - /** - * Stores the show of the grid. - * - * @var boolean - */ - public $legendShow = true; - - /** - * Stores the showForSingleSeries of the grid. - * - * @var boolean - */ - public $legendShowForSingleSeries = false; - - /** - * Stores the showForNullSeries of the grid. - * - * @var boolean - */ - public $legendShowForNullSeries = true; - - /** - * Stores the showForZeroSeries of the grid. - * - * @var boolean - */ - public $legendShowForZeroSeries = true; - - /** - * Stores the position of the grid. - * - * @var string - */ - public $legendPosition = 'bottom'; - - /** - * Stores the horizontalAlign of the grid. - * - * @var string - */ - public $legendHorizontalAlign = 'center'; - - /** - * Stores the floating of the grid. - * - * @var boolean - */ - public $legendFloating = false; - - /** - * Stores the fontSize of the grid. - * - * @var string - */ - public $legendFontSize = '14px'; - - /** - * Stores the fontFamily of the grid. - * - * @var string - */ - public $legendFontFamily = 'Helvetica, Arial'; - - /** - * Stores the fontWeight of the grid. - * - * @var string|int - */ - public $legendFontWeight = 400; - - /** - * Stores the formatter of the grid. - * - * @var function - */ - public $legendFormatter; - - /** - * Stores the inverseOrder of the grid. - * - * @var boolean - */ - public $legendInverseOrder = false; - - /** - * Stores the width of the grid. - * - * @var int - */ - public $legendWidth; - - /** - * Stores the height of the grid. - * - * @var int - */ - public $legendHeight; - - /** - * Stores the tooltipHoverFormatter of the grid. - * - * @var function - */ - public $legendTooltipHoverFormatter; - - /** - * Stores the customLegendItems of the grid. - * - * @var array - */ - public $legendCustomLegendItems = []; - - /** - * Stores the offsetX of the grid. - * - * @var int - */ - public $legendOffsetX = 0; - - /** - * Stores the offsetY of the grid. - * - * @var int - */ - public $legendOffsetY = 0; - - /** - * Stores the labels of the grid. - * - * @var array - */ - public $legendLabels = []; - - /** - * Stores the markers of the grid. - * - * @var array - */ - public $legendMarkers = []; - - /** - * Stores the itemMargin of the grid. - * - * @var array - */ - public $legendItemMargin = []; - - /** - * Stores the onItemClick of the grid. - * - * @var array - */ - public $legendOnItemClick = []; - - /** - * Stores the onItemHover of the grid. - * - * @var array - */ - public $legendOnItemHover = []; - - /** - * Set the legend show. - * - * @param string $legendShow - * - * @return this - */ - public function setLegendShow($legendShow) :Charts + public bool $legendShow = true; + + public bool $legendShowForSingleSeries = false; + + public bool $legendShowForNullSeries = true; + + public bool $legendShowForZeroSeries = true; + + public string $legendPosition = 'bottom'; + + public string $legendHorizontalAlign = 'center'; + + public bool $legendFloating = false; + + public string $legendFontSize = '14px'; + + public string $legendFontFamily = 'Helvetica, Arial'; + + public int|string $legendFontWeight = 400; + + public mixed $legendFormatter; + + public bool $legendInverseOrder = false; + + public int $legendWidth; + + public int $legendHeight; + + public mixed $legendTooltipHoverFormatter; + + public array $legendCustomLegendItems = []; + + public int $legendOffsetX = 0; + + public int $legendOffsetY = 0; + + public array $legendLabels = []; + + public array $legendMarkers = []; + + public array $legendItemMargin = []; + + public array $legendOnItemClick = []; + + public array $legendOnItemHover = []; + + public function setLegendShow(bool $legendShow): Chart { $this->legendShow = $legendShow; @@ -187,22 +65,12 @@ public function setLegendShow($legendShow) :Charts return $this; } - /** - * @return boolean - */ - public function getLegendShow() + public function getLegendShow(): bool { return $this->legendShow; } - /** - * Set the legend showForSingleSeries. - * - * @param boolean $legendShowForSingleSeries - * - * @return this - */ - public function setLegendShowForSingleSeries($legendShowForSingleSeries) :Charts + public function setLegendShowForSingleSeries(bool $legendShowForSingleSeries): Chart { $this->legendShowForSingleSeries = $legendShowForSingleSeries; @@ -215,22 +83,12 @@ public function setLegendShowForSingleSeries($legendShowForSingleSeries) :Charts return $this; } - /** - * @return boolean - */ - public function getLegendShowForSingleSeries() + public function getLegendShowForSingleSeries(): bool { return $this->legendShowForSingleSeries; } - /** - * Set the legend showForNullSeries. - * - * @param string $legendShowForNullSeries - * - * @return this - */ - public function setLegendShowForNullSeries($legendShowForNullSeries) :Charts + public function setLegendShowForNullSeries(bool $legendShowForNullSeries): Chart { $this->legendShowForNullSeries = $legendShowForNullSeries; @@ -243,22 +101,12 @@ public function setLegendShowForNullSeries($legendShowForNullSeries) :Charts return $this; } - /** - * @return boolean - */ - public function getLegendShowForNullSeries() + public function getLegendShowForNullSeries(): bool { return $this->legendShowForNullSeries; } - /** - * Set the legend showForZeroSeries. - * - * @param string $legendShowForZeroSeries - * - * @return this - */ - public function setLegendShowForZeroSeries($legendShowForZeroSeries) :Charts + public function setLegendShowForZeroSeries(bool $legendShowForZeroSeries): Chart { $this->legendShowForZeroSeries = $legendShowForZeroSeries; @@ -271,22 +119,12 @@ public function setLegendShowForZeroSeries($legendShowForZeroSeries) :Charts return $this; } - /** - * @return boolean - */ - public function getLegendShowForZeroSeries() + public function getLegendShowForZeroSeries(): bool { return $this->legendShowForZeroSeries; } - /** - * Set the legend position. - * - * @param string $legendPosition - * - * @return this - */ - public function setLegendPosition($legendPosition) :Charts + public function setLegendPosition(string $legendPosition): Chart { $this->legendPosition = $legendPosition; @@ -299,22 +137,12 @@ public function setLegendPosition($legendPosition) :Charts return $this; } - /** - * @return string - */ - public function getLegendPosition() + public function getLegendPosition(): string { return $this->legendPosition; } - /** - * Set the legend horizontalAlign. - * - * @param string $legendHorizontalAlign - * - * @return this - */ - public function setLegendHorizontalAlign($legendHorizontalAlign) :Charts + public function setLegendHorizontalAlign(string $legendHorizontalAlign): Chart { $this->legendHorizontalAlign = $legendHorizontalAlign; @@ -327,22 +155,12 @@ public function setLegendHorizontalAlign($legendHorizontalAlign) :Charts return $this; } - /** - * @return string - */ - public function getLegendHorizontalAlign() + public function getLegendHorizontalAlign(): string { return $this->legendHorizontalAlign; } - /** - * Set the legend floating. - * - * @param boolean $legendShow - * - * @return this - */ - public function setLegendFloating($legendFloating) :Charts + public function setLegendFloating(bool $legendFloating): Chart { $this->legendFloating = $legendFloating; @@ -355,22 +173,12 @@ public function setLegendFloating($legendFloating) :Charts return $this; } - /** - * @return boolean - */ - public function getLegendFloating() + public function getLegendFloating(): bool { return $this->legendFloating; } - /** - * Set the legend fontSize. - * - * @param string $legendFontSize - * - * @return this - */ - public function setLegendFontSize($legendFontSize) :Charts + public function setLegendFontSize(string $legendFontSize): Chart { $this->legendFontSize = $legendFontSize; @@ -383,22 +191,12 @@ public function setLegendFontSize($legendFontSize) :Charts return $this; } - /** - * @return boolean - */ - public function getLegendFontSize() + public function getLegendFontSize(): string { return $this->legendFontSize; } - /** - * Set the legend fontFamily. - * - * @param string $legendFontFamily - * - * @return this - */ - public function setLegendFontFamily($legendFontFamily) :Charts + public function setLegendFontFamily(string $legendFontFamily): Chart { $this->legendFontFamily = $legendFontFamily; @@ -411,22 +209,12 @@ public function setLegendFontFamily($legendFontFamily) :Charts return $this; } - /** - * @return string - */ - public function getLegendFontFamily() + public function getLegendFontFamily(): string { return $this->legendFontFamily; } - /** - * Set the legend fontWeight. - * - * @param string $legendFontWeight - * - * @return this - */ - public function setLegendFontWeight($legendFontWeight) :Charts + public function setLegendFontWeight(int|string $legendFontWeight): Chart { $this->legendFontWeight = $legendFontWeight; @@ -439,22 +227,12 @@ public function setLegendFontWeight($legendFontWeight) :Charts return $this; } - /** - * @return boolean - */ - public function getLegendFontWeight() + public function getLegendFontWeight(): int|string { return $this->legendFontWeight; } - /** - * Set the legend formatter. - * - * @param string $legendFormatter - * - * @return this - */ - public function setLegendFormatter($legendFormatter) :Charts + public function setLegendFormatter(mixed $legendFormatter): Chart { $this->legendFormatter = $legendFormatter; @@ -467,22 +245,12 @@ public function setLegendFormatter($legendFormatter) :Charts return $this; } - /** - * @return boolean - */ - public function getLegendFormatter() + public function getLegendFormatter(): mixed { return $this->legendFormatter; } - /** - * Set the legend inverseOrder. - * - * @param string $legendInverseOrder - * - * @return this - */ - public function setLegendInverseOrder($legendInverseOrder) :Charts + public function setLegendInverseOrder(string $legendInverseOrder): Chart { $this->legendInverseOrder = $legendInverseOrder; @@ -495,22 +263,12 @@ public function setLegendInverseOrder($legendInverseOrder) :Charts return $this; } - /** - * @return boolean - */ - public function getLegendInverseOrder() + public function getLegendInverseOrder(): string { return $this->legendInverseOrder; } - /** - * Set the legend width. - * - * @param string $legendWidth - * - * @return this - */ - public function setLegendWidth($legendWidth) :Charts + public function setLegendWidth(int $legendWidth): Chart { $this->legendWidth = $legendWidth; @@ -523,22 +281,12 @@ public function setLegendWidth($legendWidth) :Charts return $this; } - /** - * @return boolean - */ - public function getLegendWidth() + public function getLegendWidth(): int { return $this->legendWidth; } - /** - * Set the legend height. - * - * @param string $legendHeight - * - * @return this - */ - public function setLegendHeight($legendHeight) :Charts + public function setLegendHeight(int $legendHeight): Chart { $this->legendHeight = $legendHeight; @@ -551,22 +299,12 @@ public function setLegendHeight($legendHeight) :Charts return $this; } - /** - * @return boolean - */ - public function getLegendHeight() + public function getLegendHeight(): int { return $this->legendHeight; } - /** - * Set the legend tooltipHoverFormatter. - * - * @param string $legendTooltipHoverFormatter - * - * @return this - */ - public function setLegendTooltipHoverFormatter($legendTooltipHoverFormatter) :Charts + public function setLegendTooltipHoverFormatter(mixed $legendTooltipHoverFormatter): Chart { $this->legendTooltipHoverFormatter = $legendTooltipHoverFormatter; @@ -579,22 +317,12 @@ public function setLegendTooltipHoverFormatter($legendTooltipHoverFormatter) :Ch return $this; } - /** - * @return boolean - */ - public function getLegendTooltipHoverFormatter() + public function getLegendTooltipHoverFormatter(): mixed { return $this->legendTooltipHoverFormatter; } - /** - * Set the legend customLegendItems. - * - * @param string $legendShow - * - * @return this - */ - public function setLegendCustomLegendItems($legendCustomLegendItems) :Charts + public function setLegendCustomLegendItems(array $legendCustomLegendItems): Chart { $this->legendCustomLegendItems = $legendCustomLegendItems; @@ -607,22 +335,12 @@ public function setLegendCustomLegendItems($legendCustomLegendItems) :Charts return $this; } - /** - * @return boolean - */ - public function getLegendCustomLegendItems() + public function getLegendCustomLegendItems(): array { return $this->legendCustomLegendItems; } - /** - * Set the legend offsetX. - * - * @param string $legendShow - * - * @return this - */ - public function setLegendOffsetX($legendOffsetX) :Charts + public function setLegendOffsetX(int $legendOffsetX): Chart { $this->legendOffsetX = $legendOffsetX; @@ -635,22 +353,12 @@ public function setLegendOffsetX($legendOffsetX) :Charts return $this; } - /** - * @return boolean - */ - public function getLegendOffsetX() + public function getLegendOffsetX(): int { return $this->legendOffsetX; } - /** - * Set the legend offsetY. - * - * @param string $legendOffsetY - * - * @return this - */ - public function setLegendOffsetY($legendOffsetY) :Charts + public function setLegendOffsetY(int $legendOffsetY): Chart { $this->legendOffsetY = $legendOffsetY; @@ -663,22 +371,12 @@ public function setLegendOffsetY($legendOffsetY) :Charts return $this; } - /** - * @return boolean - */ - public function getLegendOffsetY() + public function getLegendOffsetY():int { return $this->legendOffsetY; } - /** - * Set the legend labels. - * - * @param string $legendLabels - * - * @return this - */ - public function setLegendLabels($legendLabels) :Charts + public function setLegendLabels(array $legendLabels): Chart { $this->legendLabels = $legendLabels; @@ -691,22 +389,12 @@ public function setLegendLabels($legendLabels) :Charts return $this; } - /** - * @return boolean - */ - public function getLegendLabels() + public function getLegendLabels(): array { return $this->legendLabels; } - /** - * Set the legend markers. - * - * @param string $legendMarkers - * - * @return this - */ - public function setLegendMarkers($legendMarkers) :Charts + public function setLegendMarkers(array $legendMarkers): Chart { $this->legendMarkers = $legendMarkers; @@ -719,22 +407,12 @@ public function setLegendMarkers($legendMarkers) :Charts return $this; } - /** - * @return boolean - */ - public function getLegendMarkers() + public function getLegendMarkers(): array { return $this->legendMarkers; } - /** - * Set the legend itemMargin. - * - * @param string $legendItemMargin - * - * @return this - */ - public function setLegendItemMargin($legendItemMargin) :Charts + public function setLegendItemMargin(array $legendItemMargin): Chart { $this->legendItemMargin = $legendItemMargin; @@ -747,22 +425,12 @@ public function setLegendItemMargin($legendItemMargin) :Charts return $this; } - /** - * @return boolean - */ - public function getLegendItemMargin() + public function getLegendItemMargin(): array { return $this->legendItemMargin; } - /** - * Set the legend onItemClick. - * - * @param string $legendOnItemClick - * - * @return this - */ - public function setLegendOnItemClick($legendOnItemClick) :Charts + public function setLegendOnItemClick(array $legendOnItemClick): Chart { $this->legendOnItemClick = $legendOnItemClick; @@ -775,22 +443,12 @@ public function setLegendOnItemClick($legendOnItemClick) :Charts return $this; } - /** - * @return boolean - */ - public function getLegendOnItemClick() + public function getLegendOnItemClick(): array { return $this->legendOnItemClick; } - /** - * Set the legend onItemHover. - * - * @param string $legendOnItemHover - * - * @return this - */ - public function setLegendOnItemHover($legendOnItemHover) :Charts + public function setLegendOnItemHover(array $legendOnItemHover): Chart { $this->legendOnItemHover = $legendOnItemHover; @@ -803,10 +461,7 @@ public function setLegendOnItemHover($legendOnItemHover) :Charts return $this; } - /** - * @return boolean - */ - public function getLegendOnItemHover() + public function getLegendOnItemHover(): array { return $this->legendOnItemHover; } diff --git a/src/Options/Markers.php b/src/Options/Markers.php index 8c351b9..1b924cd 100644 --- a/src/Options/Markers.php +++ b/src/Options/Markers.php @@ -6,129 +6,42 @@ trait Markers { - /** - * Stores the size of the markers. - * - * @var int - */ - public $markersSize = 4; - - /** - * Stores the colors of the markers. - * - * @var array - */ - public $markersColors = []; - - /** - * Stores the strokeColors of the markers. - * - * @var string|array - */ - public $markersStrokeColors = '#fff'; - - /** - * Stores the strokeWidth of the markers. - * - * @var int|array - */ - public $markersStrokeWidth = 2; - - /** - * Stores the strokeOpacity of the markers. - * - * @var int|array - */ - public $markersStrokeOpacity = 0.9; - - /** - * Stores the strokeDashArray of the markers. - * - * @var int|array - */ - public $markersStrokeDashArray = 0; - - /** - * Stores the fillOpacity of the markers. - * - * @var int|array - */ - public $markersFillOpacity = 1; - - /** - * Stores the discrete of the markers. - * - * @var array - */ - public $markersDiscrete = []; - - /** - * Stores the shape of the markers. - * - * @var string - */ - public $markersShape = 'circle'; - - /** - * Stores the radius of the markers. - * - * @var int - */ - public $markersRadius = 2; - - /** - * Stores the offsetX of the markers. - * - * @var int - */ - public $markersOffsetX = 0; - - /** - * Stores the offsetY of the markers. - * - * @var int - */ - public $markersOffsetY = 0; - - /** - * Stores the onClick of the markers. - * - * @var function - */ - public $markersOnClick; - - /** - * Stores the onDblClick of the markers. - * - * @var function - */ - public $markersOnDblClick; - - /** - * Stores the showNullDataPoints of the markers. - * - * @var boolean - */ - public $markersShowNullDataPoints = true; - - /** - * Stores the hover of the markers. - * - * @var array - */ - public $markersHover = [ + public int $markersSize = 4; + + public array $markersColors = []; + + public string|array $markersStrokeColors = '#fff'; + + public int|array $markersStrokeWidth = 2; + + public int|float|array $markersStrokeOpacity = 0.9; + + public int|array $markersStrokeDashArray = 0; + + public int|float|array $markersFillOpacity = 1; + + public array $markersDiscrete = []; + + public string $markersShape = 'circle'; + + public int $markersRadius = 2; + + public int $markersOffsetX = 0; + + public int $markersOffsetY = 0; + + public mixed $markersOnClick; + + public mixed $markersOnDblClick; + + public bool $markersShowNullDataPoints = true; + + public array $markersHover = [ 'size' => '', 'sizeOffset' => 3, ]; - /** - * Set the grid show. - * - * @param string $gridShow - * - * @return this - */ - public function setMarkersSize($markersSize) :Charts + public function setMarkersSize(int $markersSize): Chart { $this->markersSize = $markersSize; @@ -141,22 +54,12 @@ public function setMarkersSize($markersSize) :Charts return $this; } - /** - * @return boolean - */ - public function getMarkersSize() + public function getMarkersSize(): int { return $this->markersSize; } - /** - * Set the markers colors. - * - * @param array $markersColors - * - * @return this - */ - public function setMarkersColors($markersColors) :Charts + public function setMarkersColors(array $markersColors): Chart { $this->markersColors = $markersColors; @@ -169,22 +72,12 @@ public function setMarkersColors($markersColors) :Charts return $this; } - /** - * @return array - */ - public function getMarkersColors() + public function getMarkersColors(): array { return $this->markersColors; } - /** - * Set the markers strokeColors. - * - * @param array $markersStrokeColors - * - * @return this - */ - public function setMarkersStrokeColors($markersStrokeColors) :Charts + public function setMarkersStrokeColors(string|array $markersStrokeColors): Chart { $this->markersStrokeColors = $markersStrokeColors; @@ -197,22 +90,12 @@ public function setMarkersStrokeColors($markersStrokeColors) :Charts return $this; } - /** - * @return array - */ - public function getMarkersStrokeColors() + public function getMarkersStrokeColors(): string|array { return $this->markersStrokeColors; } - /** - * Set the markers strokeWidth. - * - * @param array $markersStrokeWidth - * - * @return this - */ - public function setMarkersStrokeWidth($markersStrokeWidth) :Charts + public function setMarkersStrokeWidth(int|array $markersStrokeWidth): Chart { $this->markersStrokeWidth = $markersStrokeWidth; @@ -225,22 +108,12 @@ public function setMarkersStrokeWidth($markersStrokeWidth) :Charts return $this; } - /** - * @return array - */ - public function getMarkersStrokeWidth() + public function getMarkersStrokeWidth(): int|array { return $this->markersStrokeWidth; } - /** - * Set the markers strokeOpacity. - * - * @param array $markersStrokeOpacity - * - * @return this - */ - public function setMarkersStrokeOpacity($markersStrokeOpacity) :Charts + public function setMarkersStrokeOpacity(int|float|array $markersStrokeOpacity): Chart { $this->markersStrokeOpacity = $markersStrokeOpacity; @@ -253,22 +126,12 @@ public function setMarkersStrokeOpacity($markersStrokeOpacity) :Charts return $this; } - /** - * @return array - */ - public function getMarkersStrokeOpacity() + public function getMarkersStrokeOpacity(): int|float|array { return $this->markersStrokeOpacity; } - /** - * Set the markers strokeDashArray. - * - * @param array $markersStrokeDashArray - * - * @return this - */ - public function setMarkersStrokeDashArray($markersStrokeDashArray) :Charts + public function setMarkersStrokeDashArray(int|array $markersStrokeDashArray): Chart { $this->markersStrokeDashArray = $markersStrokeDashArray; @@ -281,22 +144,12 @@ public function setMarkersStrokeDashArray($markersStrokeDashArray) :Charts return $this; } - /** - * @return array - */ - public function getMarkersStrokeDashArray() + public function getMarkersStrokeDashArray(): int|array { return $this->markersStrokeDashArray; } - /** - * Set the markers fillOpacity. - * - * @param array $markersFillOpacity - * - * @return this - */ - public function setMarkersFillOpacity($markersFillOpacity) :Charts + public function setMarkersFillOpacity(int|float|array $markersFillOpacity): Chart { $this->markersFillOpacity = $markersFillOpacity; @@ -309,22 +162,12 @@ public function setMarkersFillOpacity($markersFillOpacity) :Charts return $this; } - /** - * @return array - */ - public function getMarkersFillOpacity() + public function getMarkersFillOpacity(): int|float|array { return $this->markersFillOpacity; } - /** - * Set the markers discrete. - * - * @param array $markersDiscrete - * - * @return this - */ - public function setMarkersDiscrete($markersDiscrete) :Charts + public function setMarkersDiscrete(array $markersDiscrete): Chart { $this->markersDiscrete = $markersDiscrete; @@ -337,22 +180,12 @@ public function setMarkersDiscrete($markersDiscrete) :Charts return $this; } - /** - * @return array - */ - public function getMarkersDiscrete() + public function getMarkersDiscrete(): array { return $this->markersDiscrete; } - /** - * Set the markers shape. - * - * @param array $markersShape - * - * @return this - */ - public function setMarkersShape($markersShape) :Charts + public function setMarkersShape(string $markersShape): Chart { $this->markersShape = $markersShape; @@ -365,22 +198,12 @@ public function setMarkersShape($markersShape) :Charts return $this; } - /** - * @return array - */ - public function getMarkersShape() + public function getMarkersShape(): string { return $this->markersShape; } - /** - * Set the markers radius. - * - * @param array $markersRadius - * - * @return this - */ - public function setMarkersRadius($markersRadius) :Charts + public function setMarkersRadius(int $markersRadius): Chart { $this->markersRadius = $markersRadius; @@ -393,22 +216,12 @@ public function setMarkersRadius($markersRadius) :Charts return $this; } - /** - * @return array - */ - public function getMarkersRadius() + public function getMarkersRadius(): int { return $this->markersRadius; } - /** - * Set the markers offsetX. - * - * @param array $markersOffsetX - * - * @return this - */ - public function setMarkersOffsetX($markersOffsetX) :Charts + public function setMarkersOffsetX(int $markersOffsetX): Chart { $this->markersOffsetX = $markersOffsetX; @@ -421,22 +234,12 @@ public function setMarkersOffsetX($markersOffsetX) :Charts return $this; } - /** - * @return array - */ - public function getMarkersOffsetX() + public function getMarkersOffsetX(): int { return $this->markersOffsetX; } - /** - * Set the markers offsetY. - * - * @param array $markersOffsetY - * - * @return this - */ - public function setMarkersOffsetY($markersOffsetY) :Charts + public function setMarkersOffsetY(int $markersOffsetY): Chart { $this->markersOffsetY = $markersOffsetY; @@ -449,22 +252,12 @@ public function setMarkersOffsetY($markersOffsetY) :Charts return $this; } - /** - * @return array - */ - public function getMarkersOffsetY() + public function getMarkersOffsetY(): int { return $this->markersOffsetY; } - /** - * Set the markers onClick. - * - * @param array $markersOnClick - * - * @return this - */ - public function setMarkersOnClick($markersOnClick) :Charts + public function setMarkersOnClick(mixed $markersOnClick): Chart { $this->markersOnClick = $markersOnClick; @@ -477,22 +270,12 @@ public function setMarkersOnClick($markersOnClick) :Charts return $this; } - /** - * @return array - */ - public function getMarkersOnClick() + public function getMarkersOnClick(): mixed { return $this->markersOnClick; } - /** - * Set the markers onDblClick. - * - * @param array $markersOnDblClick - * - * @return this - */ - public function setMarkersOnDblClick($markersOnDblClick) :Charts + public function setMarkersOnDblClick(mixed $markersOnDblClick): Chart { $this->markersOnDblClick = $markersOnDblClick; @@ -505,22 +288,12 @@ public function setMarkersOnDblClick($markersOnDblClick) :Charts return $this; } - /** - * @return array - */ - public function getMarkersOnDblClick() + public function getMarkersOnDblClick(): mixed { return $this->markersOnDblClick; } - /** - * Set the markers showNullDataPoints. - * - * @param array $markersShowNullDataPoints - * - * @return this - */ - public function setMarkersShowNullDataPoints($markersShowNullDataPoints) :Charts + public function setMarkersShowNullDataPoints(bool $markersShowNullDataPoints): Chart { $this->markersShowNullDataPoints = $markersShowNullDataPoints; @@ -533,22 +306,12 @@ public function setMarkersShowNullDataPoints($markersShowNullDataPoints) :Charts return $this; } - /** - * @return array - */ - public function getMarkersShowNullDataPoints() + public function getMarkersShowNullDataPoints(): bool { return $this->markersShowNullDataPoints; } - /** - * Set the markers hover. - * - * @param array $markersHover - * - * @return this - */ - public function setMarkersHover($markersHover) :Charts + public function setMarkersHover(array $markersHover): Chart { $this->markersHover = $markersHover; @@ -561,10 +324,7 @@ public function setMarkersHover($markersHover) :Charts return $this; } - /** - * @return array - */ - public function getMarkersHover() + public function getMarkersHover(): array { return $this->markersHover; } diff --git a/src/Options/NoData.php b/src/Options/NoData.php index bc5e566..b9d294c 100644 --- a/src/Options/NoData.php +++ b/src/Options/NoData.php @@ -6,56 +6,19 @@ trait NoData { - /** - * Stores the text of the noData. - * - * @var string - */ - public $noDataText = ''; - - /** - * Stores the align of the noData. - * - * @var string - */ - public $noDataAlign = 'center'; - - /** - * Stores the verticalAlign of the noData. - * - * @var string - */ - public $noDataVerticalAlign = 'middle'; - - /** - * Stores the offsetX of the noData. - * - * @var int - */ - public $noDataOffsetX = 0; - - /** - * Stores the offsetY of the noData. - * - * @var int - */ - public $noDataOffsetY = 0; - - /** - * Stores the style of the noData. - * - * @var array - */ - public $noDataStyle = []; - - /** - * Set the noData text. - * - * @param string $noDataText - * - * @return this - */ - public function setNoDataText($noDataText) :Charts + public string $noDataText = ''; + + public string $noDataAlign = 'center'; + + public string $noDataVerticalAlign = 'middle'; + + public int $noDataOffsetX = 0; + + public int $noDataOffsetY = 0; + + public array $noDataStyle = []; + + public function setNoDataText(string $noDataText): Chart { $this->noDataText = $noDataText; @@ -68,22 +31,12 @@ public function setNoDataText($noDataText) :Charts return $this; } - /** - * @return string - */ - public function getNoDataText() + public function getNoDataText(): string { return $this->noDataText; } - /** - * Set the noData align. - * - * @param string $noDataAlign - * - * @return this - */ - public function setNoDataAlign($noDataAlign) :Charts + public function setNoDataAlign(string $noDataAlign): Chart { $this->noDataAlign = $noDataAlign; @@ -96,22 +49,12 @@ public function setNoDataAlign($noDataAlign) :Charts return $this; } - /** - * @return string - */ - public function getNoDataAlign() + public function getNoDataAlign(): string { return $this->noDataAlign; } - /** - * Set the noData verticalAlign. - * - * @param string $noDataVerticalAlign - * - * @return this - */ - public function setNoDataVerticalAlign($noDataVerticalAlign) :Charts + public function setNoDataVerticalAlign(string $noDataVerticalAlign): Chart { $this->noDataVerticalAlign = $noDataVerticalAlign; @@ -124,22 +67,12 @@ public function setNoDataVerticalAlign($noDataVerticalAlign) :Charts return $this; } - /** - * @return string - */ - public function getNoDataVerticalAlign() + public function getNoDataVerticalAlign(): string { return $this->noDataVerticalAlign; } - /** - * Set the noData offsetX. - * - * @param int $noDataOffsetX - * - * @return this - */ - public function setNoDataOffsetX($noDataOffsetX) :Charts + public function setNoDataOffsetX(int $noDataOffsetX): Chart { $this->noDataOffsetX = $noDataOffsetX; @@ -152,22 +85,12 @@ public function setNoDataOffsetX($noDataOffsetX) :Charts return $this; } - /** - * @return int - */ - public function getNoDataOffsetX() + public function getNoDataOffsetX(): int { return $this->noDataOffsetX; } - /** - * Set the noData offsetY. - * - * @param int $noDataOffsetY - * - * @return this - */ - public function setNoDataOffsetY($noDataOffsetY) :Charts + public function setNoDataOffsetY(int $noDataOffsetY): Chart { $this->noDataOffsetY = $noDataOffsetY; @@ -180,22 +103,12 @@ public function setNoDataOffsetY($noDataOffsetY) :Charts return $this; } - /** - * @return int - */ - public function getNoDataOffsetY() + public function getNoDataOffsetY(): int { return $this->noDataOffsetY; } - /** - * Set the noData style. - * - * @param array $noDataStyle - * - * @return this - */ - public function setNoDataStyle($noDataStyle) :Charts + public function setNoDataStyle(array $noDataStyle): Chart { $this->noDataStyle = $noDataStyle; @@ -208,10 +121,7 @@ public function setNoDataStyle($noDataStyle) :Charts return $this; } - /** - * @return array - */ - public function getNoDataStyle() + public function getNoDataStyle(): array { return $this->noDataStyle; } diff --git a/src/Options/PlotOptions.php b/src/Options/PlotOptions.php index 73b4c5e..8dbaf4f 100644 --- a/src/Options/PlotOptions.php +++ b/src/Options/PlotOptions.php @@ -6,93 +6,31 @@ trait PlotOptions { - /** - * Stores the area of the plotOptions. - * - * @var string - */ - public $area = 'origin'; - - /** - * Stores the bar of the plotOptions. - * - * @var array|collect - */ - public $bar = [ + public string $area = 'origin'; + + public array $bar = [ 'horizontal' => false, ]; - /** - * Stores the bubble of the plotOptions. - * - * @var array|collect - */ - public $bubble = []; - - /** - * Stores the bubble of the plotOptions. - * - * @var array|collect - */ - public $candlestick = []; - - /** - * Stores the boxPlot of the plotOptions. - * - * @var array|collect - */ - public $boxPlot = []; - - /** - * Stores the heatmap of the plotOptions. - * - * @var array|collect - */ - public $heatmap = []; - - /** - * Stores the treemap of the plotOptions. - * - * @var array|collect - */ - public $treemap = []; - - /** - * Stores the pie of the plotOptions. - * - * @var array|collect - */ - public $pie = []; - - /** - * Stores the polarArea of the plotOptions. - * - * @var array|collect - */ - public $polarArea = []; - - /** - * Stores the radar of the plotOptions. - * - * @var array|collect - */ - public $radar = []; - - /** - * Stores the radialBar of the plotOptions. - * - * @var array|collect - */ - public $radialBar = []; - - /** - * Set the plotOptions area. - * - * @param string $area - * - * @return this - */ - public function setArea(string $area) :Charts + public array $bubble = []; + + public array $candlestick = []; + + public array $boxPlot = []; + + public array $heatmap = []; + + public array $treemap = []; + + public array $pie = []; + + public array $polarArea = []; + + public array $radar = []; + + public array $radialBar = []; + + public function setArea(string $area): Chart { $this->area = $area; @@ -105,22 +43,12 @@ public function setArea(string $area) :Charts return $this; } - /** - * @return string - */ - public function getArea() + public function getArea(): string { return $this->area; } - /** - * Set the plotOptions bar. - * - * @param array $bar - * - * @return this - */ - public function setBar(array $bar) :Charts + public function setBar(array $bar): Chart { $this->bar = $bar; @@ -133,22 +61,12 @@ public function setBar(array $bar) :Charts return $this; } - /** - * @return array - */ - public function getBar() + public function getBar(): array { return $this->bar; } - /** - * Set the plotOptions bubble. - * - * @param array $bubble - * - * @return this - */ - public function setBubble($bubble) :Charts + public function setBubble(array $bubble): Chart { $this->bubble = $bubble; @@ -161,22 +79,12 @@ public function setBubble($bubble) :Charts return $this; } - /** - * @return array - */ - public function getBubble() + public function getBubble(): array { return $this->bubble; } - /** - * Set the plotOptions candlestick. - * - * @param array $candlestick - * - * @return this - */ - public function setCandlestick($candlestick) :Charts + public function setCandlestick(array $candlestick): Chart { $this->candlestick = $candlestick; @@ -189,22 +97,12 @@ public function setCandlestick($candlestick) :Charts return $this; } - /** - * @return array - */ - public function getCandlestick() + public function getCandlestick(): array { return $this->candlestick; } - /** - * Set the plotOptions boxPlot. - * - * @param array $boxPlot - * - * @return this - */ - public function setBoxPlot($boxPlot) :Charts + public function setBoxPlot(array $boxPlot): Chart { $this->boxPlot = $boxPlot; @@ -217,22 +115,12 @@ public function setBoxPlot($boxPlot) :Charts return $this; } - /** - * @return array - */ - public function getBoxPlot() + public function getBoxPlot(): array { return $this->boxPlot; } - /** - * Set the plotOptions heatmap. - * - * @param array $heatmap - * - * @return this - */ - public function setHeatmap($heatmap) :Charts + public function setHeatmap(array $heatmap): Chart { $this->heatmap = $heatmap; @@ -245,22 +133,12 @@ public function setHeatmap($heatmap) :Charts return $this; } - /** - * @return array - */ - public function getHeatmap() + public function getHeatmap(): array { return $this->heatmap; } - /** - * Set the plotOptions treemap. - * - * @param array $treemap - * - * @return this - */ - public function setTreemap($treemap) :Charts + public function setTreemap(array $treemap): Chart { $this->treemap = $treemap; @@ -273,22 +151,12 @@ public function setTreemap($treemap) :Charts return $this; } - /** - * @return array - */ - public function getTreemap() + public function getTreemap(): array { return $this->treemap; } - /** - * Set the plotOptions pie. - * - * @param array $pie - * - * @return this - */ - public function setPie($pie) :Charts + public function setPie(array $pie): Chart { $this->pie = $pie; @@ -301,22 +169,12 @@ public function setPie($pie) :Charts return $this; } - /** - * @return array - */ - public function getPie() + public function getPie(): array { return $this->pie; } - /** - * Set the plotOptions polarArea. - * - * @param array $polarArea - * - * @return this - */ - public function setPolarArea($polarArea) :Charts + public function setPolarArea(array $polarArea): Chart { $this->polarArea = $polarArea; @@ -329,22 +187,12 @@ public function setPolarArea($polarArea) :Charts return $this; } - /** - * @return array - */ - public function getPolarArea() + public function getPolarArea(): array { return $this->polarArea; } - /** - * Set the plotOptions radar. - * - * @param array $radar - * - * @return this - */ - public function setRadar($radar) :Charts + public function setRadar(array $radar): Chart { $this->radar = $radar; @@ -357,22 +205,12 @@ public function setRadar($radar) :Charts return $this; } - /** - * @return array - */ - public function getRadar() + public function getRadar(): array { return $this->radar; } - /** - * Set the plotOptions radialBar. - * - * @param array $radialBar - * - * @return this - */ - public function setRadialBar($radialBar) :Charts + public function setRadialBar(array $radialBar): Chart { $this->radialBar = $radialBar; @@ -385,10 +223,7 @@ public function setRadialBar($radialBar) :Charts return $this; } - /** - * @return array - */ - public function getRadialBar() + public function getRadialBar(): array { return $this->radialBar; } diff --git a/src/Options/Responsive.php b/src/Options/Responsive.php index 8f6083c..5a8a68b 100644 --- a/src/Options/Responsive.php +++ b/src/Options/Responsive.php @@ -6,28 +6,11 @@ trait Responsive { - /** - * Stores the breakpoint of the responsive. - * - * @var int - */ - public $responsiveBreakpoint; + public int $responsiveBreakpoint; - /** - * Stores the options of the responsive. - * - * @var objcet - */ - public $responsiveOptions; + public object $responsiveOptions; - /** - * Set the responsive breakpoint. - * - * @param int $responsiveBreakpoint - * - * @return this - */ - public function setResponsiveBreakpoint($responsiveBreakpoint) :Charts + public function setResponsiveBreakpoint(int $responsiveBreakpoint): Chart { $this->responsiveBreakpoint = $responsiveBreakpoint; @@ -40,22 +23,12 @@ public function setResponsiveBreakpoint($responsiveBreakpoint) :Charts return $this; } - /** - * @return int - */ - public function getResponsiveBreakpoint() + public function getResponsiveBreakpoint(): int { return $this->responsiveBreakpoint; } - /** - * Set the responsive options. - * - * @param object $responsiveOptions - * - * @return this - */ - public function setResponsiveOptions($responsiveOptions) :Charts + public function setResponsiveOptions(object $responsiveOptions): Chart { $this->responsiveOptions = $responsiveOptions; @@ -68,10 +41,7 @@ public function setResponsiveOptions($responsiveOptions) :Charts return $this; } - /** - * @return object - */ - public function getResponsiveOptions() + public function getResponsiveOptions(): object { return $this->responsiveOptions; } diff --git a/src/Options/States.php b/src/Options/States.php index f4b768d..6b4237a 100644 --- a/src/Options/States.php +++ b/src/Options/States.php @@ -6,35 +6,13 @@ trait States { - /** - * Stores the normal of the states. - * - * @var array - */ - public $statesNormal; - - /** - * Stores the hover of the states. - * - * @var array - */ - public $statesHover; - - /** - * Stores the active of the states. - * - * @var array - */ - public $statesActive; - - /** - * Set the states normal. - * - * @param array $statesNormal - * - * @return this - */ - public function setStatesNormal($statesNormal) :Charts + public array $statesNormal; + + public array $statesHover; + + public array $statesActive; + + public function setStatesNormal(array $statesNormal): Chart { $this->statesNormal = $statesNormal; @@ -47,22 +25,12 @@ public function setStatesNormal($statesNormal) :Charts return $this; } - /** - * @return array - */ - public function getStatesNormal() + public function getStatesNormal(): array { return $this->statesNormal; } - /** - * Set the states hover. - * - * @param string $statesHover - * - * @return this - */ - public function setStatesHover($statesHover) :Charts + public function setStatesHover(array $statesHover): Chart { $this->statesHover = $statesHover; @@ -75,22 +43,12 @@ public function setStatesHover($statesHover) :Charts return $this; } - /** - * @return array - */ - public function getStatesHover() + public function getStatesHover(): array { return $this->statesHover; } - /** - * Set the states active. - * - * @param array $statesActive - * - * @return this - */ - public function setStatesActive($statesActive) :Charts + public function setStatesActive(array $statesActive): Chart { $this->statesActive = $statesActive; @@ -103,10 +61,7 @@ public function setStatesActive($statesActive) :Charts return $this; } - /** - * @return array - */ - public function getStatesActive() + public function getStatesActive(): array { return $this->statesActive; } diff --git a/src/Options/Stroke.php b/src/Options/Stroke.php index 09870b9..afa238f 100644 --- a/src/Options/Stroke.php +++ b/src/Options/Stroke.php @@ -6,56 +6,19 @@ trait Stroke { - /** - * Stores the show of the stroke. - * - * @var boolean - */ - public $strokeShow = true; - - /** - * Stores the curve of the stroke. - * - * @var string|arrat - */ - public $strokeCurve = 'smooth'; - - /** - * Stores the lineCap of the stroke. - * - * @var string - */ - public $strokeLineCap = 'butt'; - - /** - * Stores the colors of the stroke. - * - * @var string - */ - public $strokeColors = []; - - /** - * Stores the width of the stroke. - * - * @var int|array - */ - public $strokeWidth = 2; - - /** - * Stores the dashArray of the stroke. - * - * @var int|array - */ - public $strokeDashArray = 0; - - /** - * Set the stroke show. - * - * @param boolean $strokeShow - * - * @return this - */ - public function setStrokeShow($strokeShow) :Charts + public bool $strokeShow = true; + + public string|array $strokeCurve = 'smooth'; + + public string $strokeLineCap = 'butt'; + + public array $strokeColors = []; + + public int|array $strokeWidth = 2; + + public int|array $strokeDashArray = 0; + + public function setStrokeShow(bool $strokeShow): Chart { $this->strokeShow = $strokeShow; @@ -68,22 +31,12 @@ public function setStrokeShow($strokeShow) :Charts return $this; } - /** - * @return boolean - */ - public function getStrokeShow() + public function getStrokeShow(): bool { return $this->strokeShow; } - /** - * Set the stroke curve. - * - * @param string $strokeCurve - * - * @return this - */ - public function setStrokeCurve($strokeCurve) :Charts + public function setStrokeCurve(string|array $strokeCurve): Chart { $this->strokeCurve = $strokeCurve; @@ -96,22 +49,12 @@ public function setStrokeCurve($strokeCurve) :Charts return $this; } - /** - * @return string - */ - public function getStrokeCurve() + public function getStrokeCurve(): string|array { return $this->strokeCurve; } - /** - * Set the stroke lineCap. - * - * @param string $strokeLineCap - * - * @return this - */ - public function setStrokeLineCap($strokeLineCap) :Charts + public function setStrokeLineCap(string $strokeLineCap): Chart { $this->strokeLineCap = $strokeLineCap; @@ -124,22 +67,12 @@ public function setStrokeLineCap($strokeLineCap) :Charts return $this; } - /** - * @return string - */ - public function getStrokeLineCap() + public function getStrokeLineCap(): string { return $this->strokeLineCap; } - /** - * Set the stroke colors. - * - * @param array $strokeColors - * - * @return this - */ - public function setStrokeColors($strokeColors) :Charts + public function setStrokeColors(array $strokeColors): Chart { $this->strokeColors = $strokeColors; @@ -152,22 +85,12 @@ public function setStrokeColors($strokeColors) :Charts return $this; } - /** - * @return boolean - */ - public function getStrokeColors() + public function getStrokeColors(): array { return $this->strokeColors; } - /** - * Set the stroke width. - * - * @param string|array $strokeWidth - * - * @return this - */ - public function setStrokeWidth($strokeWidth) :Charts + public function setStrokeWidth(int|array $strokeWidth): Chart { $this->strokeWidth = $strokeWidth; @@ -180,22 +103,12 @@ public function setStrokeWidth($strokeWidth) :Charts return $this; } - /** - * @return string|array - */ - public function getStrokeWidth() + public function getStrokeWidth(): int|array { return $this->strokeWidth; } - /** - * Set the stroke dashArray. - * - * @param int|array $strokeDashArray - * - * @return this - */ - public function setStrokeDashArray($strokeDashArray) :Charts + public function setStrokeDashArray(int|array $strokeDashArray): Chart { $this->strokeDashArray = $strokeDashArray; @@ -208,10 +121,7 @@ public function setStrokeDashArray($strokeDashArray) :Charts return $this; } - /** - * @return int|array - */ - public function getStrokeDashArray() + public function getStrokeDashArray(): int|array { return $this->strokeDashArray; } diff --git a/src/Options/Subtitle.php b/src/Options/Subtitle.php index 165295a..8519ba1 100644 --- a/src/Options/Subtitle.php +++ b/src/Options/Subtitle.php @@ -6,63 +6,21 @@ trait Subtitle { - /** - * Stores the subtitle of the title. - * - * @var string - */ - public $subtitle = ''; - - /** - * Stores the subtitlePosition of the subtitle. - * - * @var int|string - */ - public $subtitleAlign = 'left'; - - /** - * Stores the margin of the subtitle. - * - * @var int - */ - public $subtitleMargin = 10; - - /** - * Stores the offsetX of the subtitle. - * - * @var int - */ - public $subtitleOffsetX = 0; - - /** - * Stores the offsetY of the subtitle. - * - * @var int - */ - public $subtitleOffsetY = 0; - - /** - * Stores the floating of the subtitle. - * - * @var boolean - */ - public $subtitleFloating = false; - - /** - * Stores the foreColor of the chart. - * - * @var array - */ - public $subtitleStyle = []; - - /** - * Set the subtitle text. - * - * @param int $height - * - * @return this - */ - public function setSubtitle(string $subtitle) :Charts + public string $subtitle = ''; + + public string $subtitleAlign = 'left'; + + public int $subtitleMargin = 10; + + public int $subtitleOffsetX = 0; + + public int $subtitleOffsetY = 0; + + public bool $subtitleFloating = false; + + public array $subtitleStyle = []; + + public function setSubtitle(string $subtitle): Chart { $this->subtitle = $subtitle; @@ -75,73 +33,42 @@ public function setSubtitle(string $subtitle) :Charts return $this; } - /** - * @return int - */ - public function getSubtitle() + public function getSubtitle(): string { return $this->subtitle; } - /** - * Set the subtitle position. - * - * @param string $subtitlePosition - * - * @return this - */ - public function setSubtitlePosition($subtitlePosition) :Charts + public function setSubtitlePosition(string $subtitlePosition): Chart { $this->setSubtitleAlign($subtitlePosition); return $this; } - /** - * @return string - */ - public function getSubtitlePosition() + public function getSubtitlePosition(): string { return $this->getSubtitleAlign(); } - /** - * Set the subtitle align. - * - * @param string $subtitleAlign - * - * @return this - */ - public function setSubtitleAlign($subtitleAlign) :Charts + public function setSubtitleAlign(string $subtitleAlign): Chart { $this->subtitleAlign = $subtitleAlign; $this->setOption([ 'subtitle' => [ - 'align' => $titleAlign, + 'align' => $subtitleAlign, ], ]); return $this; - return $this; } - /** - * @return string - */ - public function getSubtitleAlign() + public function getSubtitleAlign(): string { return $this->subtitleAlign; } - /** - * Set the subtitle margin. - * - * @param array $subtitleMargin - * - * @return this - */ - public function setSubtitleMargin($subtitleMargin) :Charts + public function setSubtitleMargin(int $subtitleMargin): Chart { $this->subtitleMargin = $subtitleMargin; @@ -154,22 +81,12 @@ public function setSubtitleMargin($subtitleMargin) :Charts return $this; } - /** - * @return int - */ - public function getSubtitleMargin() + public function getSubtitleMargin(): int { return $this->subtitleMargin; } - /** - * Set the subtitle offsetX. - * - * @param int $subtitleOffsetX - * - * @return this - */ - public function setSubtitleOffsetX($subtitleOffsetX) :Charts + public function setSubtitleOffsetX(int $subtitleOffsetX): Chart { $this->subtitleOffsetX = $subtitleOffsetX; @@ -182,22 +99,12 @@ public function setSubtitleOffsetX($subtitleOffsetX) :Charts return $this; } - /** - * @return int - */ - public function getSubtitleOffsetX() + public function getSubtitleOffsetX(): int { return $this->subtitleOffsetX; } - /** - * Set the subtitle offsetY. - * - * @param int $subtitleOffsetY - * - * @return this - */ - public function setSubtitleOffsetY($subtitleOffsetY) :Charts + public function setSubtitleOffsetY(int $subtitleOffsetY): Chart { $this->subtitleOffsetY = $subtitleOffsetY; @@ -210,22 +117,12 @@ public function setSubtitleOffsetY($subtitleOffsetY) :Charts return $this; } - /** - * @return array - */ - public function getSubtitleOffsetY() + public function getSubtitleOffsetY(): int { return $this->subtitleOffsetY; } - /** - * Set the subtitle floating. - * - * @param string $subtitleFloating - * - * @return this - */ - public function setSubtitleFloating(string $subtitleFloating) :Charts + public function setSubtitleFloating(bool $subtitleFloating): Chart { $this->fontFamily = $subtitleFloating; @@ -238,22 +135,12 @@ public function setSubtitleFloating(string $subtitleFloating) :Charts return $this; } - /** - * @return string - */ - public function getSubtitleFloating() + public function getSubtitleFloating(): bool { return $this->subtitleFloating; } - /** - * Set the subtitle style. - * - * @param string $subtitleStyle - * - * @return this - */ - public function setSubtitleStyle($subtitleStyle) :Charts + public function setSubtitleStyle(array $subtitleStyle): Chart { $this->subtitleStyle = $subtitleStyle; @@ -266,10 +153,7 @@ public function setSubtitleStyle($subtitleStyle) :Charts return $this; } - /** - * @return string - */ - public function getSubtitleStyle() + public function getSubtitleStyle(): array { return $this->subtitleStyle; } diff --git a/src/Options/Theme.php b/src/Options/Theme.php index 5344648..e4d60a9 100644 --- a/src/Options/Theme.php +++ b/src/Options/Theme.php @@ -6,35 +6,13 @@ trait Theme { - /** - * Stores the mode of the theme. - * - * @var string - */ - public $themeMode = 'light'; - - /** - * Stores the palette of the theme. - * - * @var string - */ - public $themePalette = 'palette1'; - - /** - * Stores the monochrome of the theme. - * - * @var array - */ - public $themeMonochrome = []; - - /** - * Set the theme mode. - * - * @param string $themeMode - * - * @return this - */ - public function setThemeMode($themeMode) :Charts + public string $themeMode = 'light'; + + public string $themePalette = 'palette1'; + + public array $themeMonochrome = []; + + public function setThemeMode(string $themeMode): Chart { $this->themeMode = $themeMode; @@ -47,22 +25,12 @@ public function setThemeMode($themeMode) :Charts return $this; } - /** - * @return string - */ - public function getThemeMode() + public function getThemeMode(): string { return $this->themeMode; } - /** - * Set the theme palette. - * - * @param string $themePalette - * - * @return this - */ - public function setThemePalette($themePalette) :Charts + public function setThemePalette(string $themePalette): Chart { $this->themePalette = $themePalette; @@ -75,22 +43,12 @@ public function setThemePalette($themePalette) :Charts return $this; } - /** - * @return string - */ - public function getThemePalette() + public function getThemePalette(): string { return $this->themePalette; } - /** - * Set the theme monochrome. - * - * @param array $themeMonochrome - * - * @return this - */ - public function setThemeMonochrome($themeMonochrome) :Charts + public function setThemeMonochrome(array $themeMonochrome): Chart { $this->themeMonochrome = $themeMonochrome; @@ -103,10 +61,7 @@ public function setThemeMonochrome($themeMonochrome) :Charts return $this; } - /** - * @return array - */ - public function getThemeMonochrome() + public function getThemeMonochrome(): array { return $this->themeMonochrome; } diff --git a/src/Options/Title.php b/src/Options/Title.php index 2ad3e14..e02d614 100644 --- a/src/Options/Title.php +++ b/src/Options/Title.php @@ -6,63 +6,21 @@ trait Title { - /** - * Stores the title of the title. - * - * @var string - */ - public $title = ''; - - /** - * Stores the titlePosition of the title. - * - * @var int|string - */ - public $titleAlign = 'left'; - - /** - * Stores the margin of the title. - * - * @var int - */ - public $titleMargin = 10; - - /** - * Stores the offsetX of the title. - * - * @var int - */ - public $titleOffsetX = 0; - - /** - * Stores the offsetY of the title. - * - * @var int - */ - public $titleOffsetY = 0; - - /** - * Stores the floating of the title. - * - * @var boolean - */ - public $titleFloating = false; - - /** - * Stores the foreColor of the chart. - * - * @var array - */ - public $titleStyle = []; - - /** - * Set the title text. - * - * @param int $height - * - * @return this - */ - public function setTitle(string $title) :Charts + public string $title = ''; + + public string $titleAlign = 'left'; + + public int $titleMargin = 10; + + public int $titleOffsetX = 0; + + public int $titleOffsetY = 0; + + public bool $titleFloating = false; + + public array $titleStyle = []; + + public function setTitle(string $title): Chart { $this->title = $title; @@ -75,44 +33,24 @@ public function setTitle(string $title) :Charts return $this; } - /** - * @return int - */ - public function getTitle() + public function getTitle(): string { return $this->title; } - /** - * Set the title position. - * - * @param string $titlePosition - * - * @return this - */ - public function setTitlePosition($titlePosition) :Charts + public function setTitlePosition(string $titlePosition): Chart { $this->setTitleAlign($titlePosition); return $this; } - /** - * @return string - */ - public function getTitlePosition() + public function getTitlePosition(): string { return $this->getTitleAlign(); } - /** - * Set the title align. - * - * @param string $titleAlign - * - * @return this - */ - public function setTitleAlign($titleAlign) :Charts + public function setTitleAlign(string $titleAlign): Chart { $this->titleAlign = $titleAlign; @@ -123,25 +61,14 @@ public function setTitleAlign($titleAlign) :Charts ]); return $this; - return $this; } - /** - * @return string - */ - public function getTitleAlign() + public function getTitleAlign(): string { return $this->titleAlign; } - /** - * Set the title margin. - * - * @param array $titleMargin - * - * @return this - */ - public function setTitleMargin($titleMargin) :Charts + public function setTitleMargin(int $titleMargin): Chart { $this->titleMargin = $titleMargin; @@ -154,22 +81,12 @@ public function setTitleMargin($titleMargin) :Charts return $this; } - /** - * @return int - */ - public function getTitleMargin() + public function getTitleMargin(): int { return $this->titleMargin; } - /** - * Set the title offsetX. - * - * @param int $titleOffsetX - * - * @return this - */ - public function setTitleOffsetX($titleOffsetX) :Charts + public function setTitleOffsetX(int $titleOffsetX): Chart { $this->titleOffsetX = $titleOffsetX; @@ -182,22 +99,12 @@ public function setTitleOffsetX($titleOffsetX) :Charts return $this; } - /** - * @return int - */ - public function getTitleOffsetX() + public function getTitleOffsetX(): int { return $this->titleOffsetX; } - /** - * Set the title offsetY. - * - * @param int $titleOffsetY - * - * @return this - */ - public function setTitleOffsetY($titleOffsetY) :Charts + public function setTitleOffsetY(int $titleOffsetY): Chart { $this->titleOffsetY = $titleOffsetY; @@ -210,22 +117,12 @@ public function setTitleOffsetY($titleOffsetY) :Charts return $this; } - /** - * @return array - */ - public function getTitleOffsetY() + public function getTitleOffsetY(): int { return $this->titleOffsetY; } - /** - * Set the title floating. - * - * @param string $titleFloating - * - * @return this - */ - public function setTitleFloating(string $titleFloating) :Charts + public function setTitleFloating(bool $titleFloating): Chart { $this->titleFloating = $titleFloating; @@ -238,22 +135,12 @@ public function setTitleFloating(string $titleFloating) :Charts return $this; } - /** - * @return string - */ - public function getTitleFloating() + public function getTitleFloating(): bool { return $this->titleFloating; } - /** - * Set the title style. - * - * @param string $titleStyle - * - * @return this - */ - public function setTitleStyle($titleStyle) :Charts + public function setTitleStyle(array $titleStyle): Chart { $this->titleStyle = $titleStyle; @@ -266,10 +153,7 @@ public function setTitleStyle($titleStyle) :Charts return $this; } - /** - * @return string - */ - public function getTitleStyle() + public function getTitleStyle(): array { return $this->titleStyle; } diff --git a/src/Options/Tooltip.php b/src/Options/Tooltip.php index fc2b660..b749b9c 100644 --- a/src/Options/Tooltip.php +++ b/src/Options/Tooltip.php @@ -6,133 +6,41 @@ trait Tooltip { - /** - * Stores the enabled of the tooltip. - * - * @var boolean - */ - public $tooltipEnabled = true; + public bool $tooltipEnabled = true; - /** - * Stores the enabled of the tooltip. - * - * @var array - */ - public $tooltipEnabledOnSeries = []; + public array $tooltipEnabledOnSeries = []; - /** - * Stores the shared of the tooltip. - * - * @var boolean - */ - public $tooltipShared = true; + public bool $tooltipShared = true; - /** - * Stores the followCursor of the tooltip. - * - * @var boolean - */ - public $tooltipFollowCursor = false; + public bool $tooltipFollowCursor = false; - /** - * Stores the intersect of the tooltip. - * - * @var boolean - */ - public $tooltipIntersect = false; + public bool $tooltipIntersect = false; - /** - * Stores the inverseOrder of the tooltip. - * - * @var boolean - */ - public $tooltipInverseOrder = false; + public bool $tooltipInverseOrder = false; - /** - * Stores the custom of the tooltip. - * - * @var function - */ - public $tooltipCustom; + public mixed $tooltipCustom; - /** - * Stores the fillSeriesColor of the tooltip. - * - * @var boolean - */ - public $tooltipFillSeriesColor = false; + public bool $tooltipFillSeriesColor = false; - /** - * Stores the theme of the tooltip. - * - * @var string - */ - public $tooltipTheme = false; + public bool $tooltipTheme = false; - /** - * Stores the style of the tooltip. - * - * @var array - */ - public $tooltipStyle = []; + public array $tooltipStyle = []; - /** - * Stores the onDatasetHover of the tooltip. - * - * @var array - */ - public $tooltipOnDatasetHover = []; + public array $tooltipOnDatasetHover = []; - /** - * Stores the x of the tooltip. - * - * @var array - */ - public $tooltipX = []; + public array $tooltipX = []; - /** - * Stores the y of the tooltip. - * - * @var array - */ - public $tooltipY = []; + public array $tooltipY = []; - /** - * Stores the z of the tooltip. - * - * @var array - */ - public $tooltipZ = []; + public array $tooltipZ = []; - /** - * Stores the marker of the tooltip. - * - * @var array - */ - public $tooltipMarker = []; + public array $tooltipMarker = []; - /** - * Stores the items of the tooltip. - * - * @var array - */ - public $tooltipItems = []; + public array $tooltipItems = []; - /** - * Stores the fixed of the tooltip. - * - * @var array - */ - public $tooltipFixed = []; + public array $tooltipFixed = []; - /** - * Set the enabled tooltip. - * - * @param string $tooltipEnabled - * - * @return this - */ - public function setTooltipEnabled($tooltipEnabled) :Charts + public function setTooltipEnabled(bool $tooltipEnabled): Chart { $this->tooltipEnabled = $tooltipEnabled; @@ -145,22 +53,12 @@ public function setTooltipEnabled($tooltipEnabled) :Charts return $this; } - /** - * @return boolean - */ - public function getTooltipEnabled() + public function getTooltipEnabled(): bool { return $this->tooltipEnabled; } - /** - * Set the enabledOnSeries tooltip. - * - * @param string $tooltipEnabledOnSeries - * - * @return this - */ - public function setTooltipEnabledOnSeries($tooltipEnabledOnSeries) :Charts + public function setTooltipEnabledOnSeries(array $tooltipEnabledOnSeries): Chart { $this->tooltipEnabledOnSeries = $tooltipEnabledOnSeries; @@ -173,22 +71,12 @@ public function setTooltipEnabledOnSeries($tooltipEnabledOnSeries) :Charts return $this; } - /** - * @return boolean - */ - public function getTooltipEnabledOnSeries() + public function getTooltipEnabledOnSeries(): array { return $this->tooltipEnabledOnSeries; } - /** - * Set the shared tooltip. - * - * @param string $tooltipShared - * - * @return this - */ - public function setTooltipShared($tooltipShared) :Charts + public function setTooltipShared(bool $tooltipShared): Chart { $this->tooltipShared = $tooltipShared; @@ -201,22 +89,12 @@ public function setTooltipShared($tooltipShared) :Charts return $this; } - /** - * @return boolean - */ - public function getTooltipShared() + public function getTooltipShared(): bool { return $this->tooltipShared; } - /** - * Set the followCursor tooltip. - * - * @param string $tooltipFollowCursor - * - * @return this - */ - public function setTooltipFollowCursor($tooltipFollowCursor) :Charts + public function setTooltipFollowCursor(bool $tooltipFollowCursor): Chart { $this->tooltipFollowCursor = $tooltipFollowCursor; @@ -229,22 +107,12 @@ public function setTooltipFollowCursor($tooltipFollowCursor) :Charts return $this; } - /** - * @return boolean - */ - public function getTooltipFollowCursor() + public function getTooltipFollowCursor(): bool { return $this->tooltipFollowCursor; } - /** - * Set the intersect tooltip. - * - * @param string $tooltipIntersect - * - * @return this - */ - public function setTooltipIntersect($tooltipIntersect) :Charts + public function setTooltipIntersect(bool $tooltipIntersect): Chart { $this->tooltipIntersect = $tooltipIntersect; @@ -257,22 +125,12 @@ public function setTooltipIntersect($tooltipIntersect) :Charts return $this; } - /** - * @return boolean - */ - public function getTooltipIntersect() + public function getTooltipIntersect(): bool { return $this->tooltipIntersect; } - /** - * Set the inverseOrder tooltip. - * - * @param string $tooltipInverseOrder - * - * @return this - */ - public function setTooltipInverseOrder($tooltipInverseOrder) :Charts + public function setTooltipInverseOrder(bool $tooltipInverseOrder): Chart { $this->tooltipInverseOrder = $tooltipInverseOrder; @@ -285,22 +143,12 @@ public function setTooltipInverseOrder($tooltipInverseOrder) :Charts return $this; } - /** - * @return boolean - */ - public function getTooltipInverseOrder() + public function getTooltipInverseOrder(): bool { return $this->tooltipInverseOrder; } - /** - * Set the custom tooltip. - * - * @param string $tooltipCustom - * - * @return this - */ - public function setTooltipCustom($tooltipCustom) :Charts + public function setTooltipCustom(mixed $tooltipCustom): Chart { $this->tooltipCustom = $tooltipCustom; @@ -313,22 +161,12 @@ public function setTooltipCustom($tooltipCustom) :Charts return $this; } - /** - * @return boolean - */ - public function getTooltipCustom() + public function getTooltipCustom(): mixed { return $this->tooltipCustom; } - /** - * Set the fillSeriesColor tooltip. - * - * @param string $tooltipFillSeriesColor - * - * @return this - */ - public function setTooltipFillSeriesColor($tooltipFillSeriesColor) :Charts + public function setTooltipFillSeriesColor(bool $tooltipFillSeriesColor): Chart { $this->tooltipFillSeriesColor = $tooltipFillSeriesColor; @@ -341,22 +179,12 @@ public function setTooltipFillSeriesColor($tooltipFillSeriesColor) :Charts return $this; } - /** - * @return boolean - */ - public function getTooltipFillSeriesColor() + public function getTooltipFillSeriesColor(): bool { return $this->tooltipFillSeriesColor; } - /** - * Set the theme tooltip. - * - * @param string $tooltipTheme - * - * @return this - */ - public function setTooltipTheme($tooltipTheme) :Charts + public function setTooltipTheme(bool $tooltipTheme): Chart { $this->tooltipTheme = $tooltipTheme; @@ -369,22 +197,12 @@ public function setTooltipTheme($tooltipTheme) :Charts return $this; } - /** - * @return boolean - */ - public function getTooltipTheme() + public function getTooltipTheme(): bool { return $this->tooltipTheme; } - /** - * Set the style tooltip. - * - * @param string $tooltipStyle - * - * @return this - */ - public function setTooltipStyle($tooltipStyle) :Charts + public function setTooltipStyle(array $tooltipStyle): Chart { $this->tooltipStyle = $tooltipStyle; @@ -397,22 +215,12 @@ public function setTooltipStyle($tooltipStyle) :Charts return $this; } - /** - * @return boolean - */ - public function getTooltipStyle() + public function getTooltipStyle(): array { return $this->tooltipStyle; } - /** - * Set the onDatasetHover tooltip. - * - * @param string $tooltipOnDatasetHover - * - * @return this - */ - public function setTooltipOnDatasetHover($tooltipOnDatasetHover) :Charts + public function setTooltipOnDatasetHover(array $tooltipOnDatasetHover): Chart { $this->tooltipOnDatasetHover = $tooltipOnDatasetHover; @@ -425,22 +233,12 @@ public function setTooltipOnDatasetHover($tooltipOnDatasetHover) :Charts return $this; } - /** - * @return boolean - */ - public function getTooltipOnDatasetHover() + public function getTooltipOnDatasetHover(): array { return $this->tooltipOnDatasetHover; } - /** - * Set the x tooltip. - * - * @param string $tooltipX - * - * @return this - */ - public function setTooltipX($tooltipX) :Charts + public function setTooltipX(array $tooltipX): Chart { $this->tooltipX = $tooltipX; @@ -453,22 +251,12 @@ public function setTooltipX($tooltipX) :Charts return $this; } - /** - * @return boolean - */ - public function getTooltipX() + public function getTooltipX(): array { return $this->tooltipX; } - /** - * Set the y tooltip. - * - * @param string $tooltipY - * - * @return this - */ - public function setTooltipY($tooltipY) :Charts + public function setTooltipY(array $tooltipY): Chart { $this->tooltipY = $tooltipY; @@ -481,22 +269,12 @@ public function setTooltipY($tooltipY) :Charts return $this; } - /** - * @return boolean - */ - public function getTooltipY() + public function getTooltipY(): array { return $this->tooltipY; } - /** - * Set the z tooltip. - * - * @param string $tooltipZ - * - * @return this - */ - public function setTooltipZ($tooltipZ) :Charts + public function setTooltipZ(array $tooltipZ): Chart { $this->tooltipZ = $tooltipZ; @@ -509,22 +287,12 @@ public function setTooltipZ($tooltipZ) :Charts return $this; } - /** - * @return boolean - */ - public function getTooltipZ() + public function getTooltipZ(): array { return $this->tooltipZ; } - /** - * Set the marker tooltip. - * - * @param string $tooltipShared - * - * @return this - */ - public function setTooltipMarker($tooltipMarker) :Charts + public function setTooltipMarker(array $tooltipMarker): Chart { $this->tooltipMarker = $tooltipMarker; @@ -537,10 +305,7 @@ public function setTooltipMarker($tooltipMarker) :Charts return $this; } - /** - * @return boolean - */ - public function getTooltipMarker() + public function getTooltipMarker(): array { return $this->tooltipMarker; } @@ -552,7 +317,7 @@ public function getTooltipMarker() * * @return this */ - public function setTooltipItems($tooltipItems) :Charts + public function setTooltipItems(array $tooltipItems): Chart { $this->tooltipItems = $tooltipItems; @@ -565,22 +330,12 @@ public function setTooltipItems($tooltipItems) :Charts return $this; } - /** - * @return boolean - */ - public function getTooltipItems() + public function getTooltipItems(): array { return $this->tooltipItems; } - /** - * Set the fixed tooltip. - * - * @param string $tooltipFixed - * - * @return this - */ - public function setTooltipFixed($tooltipFixed) :Charts + public function setTooltipFixed(array $tooltipFixed): Chart { $this->tooltipFixed = $tooltipFixed; @@ -593,10 +348,7 @@ public function setTooltipFixed($tooltipFixed) :Charts return $this; } - /** - * @return boolean - */ - public function getTooltipFixed() + public function getTooltipFixed(): array { return $this->tooltipFixed; } diff --git a/src/Options/Xaxis.php b/src/Options/Xaxis.php index 8b90273..e82a3d6 100644 --- a/src/Options/Xaxis.php +++ b/src/Options/Xaxis.php @@ -6,133 +6,41 @@ trait Xaxis { - /** - * Stores the show of the xaxis. - * - * @var boolean - */ - public $xaxisType = true; - - /** - * Stores the categories of the xaxis. - * - * @var array - */ - public $xaxisCategories = true; - - /** - * Stores the tickAmount of the xaxis. - * - * @var int - */ - public $xaxisTickAmount = 6; - - /** - * Stores the tickPlacement of the xaxis. - * - * @var string - */ - public $xaxisTickPlacement = 'between'; - - /** - * Stores the min of the xaxis. - * - * @var int - */ - public $xaxisMin; - - /** - * Stores the max of the xaxis. - * - * @var int - */ - public $xaxisMax; - - /** - * Stores the range of the xaxis. - * - * @var int - */ - public $xaxisRange; - - /** - * Stores the floating of the xaxis. - * - * @var boolean - */ - public $xaxisFloating = false; - - /** - * Stores the decimalsInFloat of the xaxis. - * - * @var string - */ - public $xaxisDecimalsInFloat = ''; - - /** - * Stores the logarithmic of the xaxis. - * - * @var array - */ - public $xaxisOverwriteCategories; - - /** - * Stores the logBase of the xaxis. - * - * @var string - */ - public $xaxisPosition = 'bottom'; - - /** - * Stores the labels of the xaxis. - * - * @var array - */ - public $xaxisLabels = []; - - /** - * Stores the axisBorder of the xaxis. - * - * @var array - */ - public $xaxisAxisBorder = []; - - /** - * Stores the axisTicks of the xaxis. - * - * @var array - */ - public $xaxisAxisTicks = []; - - /** - * Stores the title of the xaxis. - * - * @var array - */ - public $xaxisTitle = []; - - /** - * Stores the crosshairs of the xaxis. - * - * @var array - */ - public $xaxisCrosshairs = []; - - /** - * Stores the tooltip of the xaxis. - * - * @var array - */ - public $xaxisTooltip = []; - - /** - * Set the xaxis type. - * - * @param boolean $xaxisType - * - * @return this - */ - public function setXaxisType($xaxisType) :Charts + public string $xaxisType = 'category'; + + public array $xaxisCategories = []; + + public int $xaxisTickAmount = 6; + + public string $xaxisTickPlacement = 'between'; + + public int $xaxisMin; + + public int $xaxisMax; + + public int $xaxisRange; + + public bool $xaxisFloating = false; + + public int $xaxisDecimalsInFloat; + + public array $xaxisOverwriteCategories; + + public string $xaxisPosition = 'bottom'; + + public array $xaxisLabels = []; + + public array $xaxisAxisBorder = []; + + public array $xaxisAxisTicks = []; + + public array $xaxisTitle = []; + + public array $xaxisCrosshairs = []; + + public array $xaxisTooltip = []; + + public function setXaxisType(string $xaxisType): Chart { $this->xaxisType = $xaxisType; @@ -145,22 +53,12 @@ public function setXaxisType($xaxisType) :Charts return $this; } - /** - * @return boolean - */ - public function getXaxisType() + public function getXaxisType(): string { return $this->xaxisType; } - /** - * Set the xaxis categories. - * - * @param array $xaxisCategories - * - * @return this - */ - public function setXaxisCategories($xaxisCategories) :Charts + public function setXaxisCategories(array $xaxisCategories): Chart { $this->xaxisCategories = $xaxisCategories; @@ -173,22 +71,12 @@ public function setXaxisCategories($xaxisCategories) :Charts return $this; } - /** - * @return array - */ - public function getXaxisCategories() + public function getXaxisCategories(): array { return $this->xaxisCategories; } - /** - * Set the xaxis tickAmount. - * - * @param int $xaxisTickAmount - * - * @return this - */ - public function setXaxisTickAmount($xaxisTickAmount) :Charts + public function setXaxisTickAmount(int $xaxisTickAmount): Chart { $this->xaxisTickAmount = $xaxisTickAmount; @@ -201,22 +89,12 @@ public function setXaxisTickAmount($xaxisTickAmount) :Charts return $this; } - /** - * @return int - */ - public function getXaxisTickAmount() + public function getXaxisTickAmount(): int { return $this->xaxisTickAmount; } - /** - * Set the xaxis tickPlacement. - * - * @param string $xaxisTickPlacement - * - * @return this - */ - public function setXaxisTickPlacement($xaxisTickPlacement) :Charts + public function setXaxisTickPlacement(string $xaxisTickPlacement): Chart { $this->xaxisTickPlacement = $xaxisTickPlacement; @@ -229,22 +107,12 @@ public function setXaxisTickPlacement($xaxisTickPlacement) :Charts return $this; } - /** - * @return string - */ - public function getXaxisTickPlacement() + public function getXaxisTickPlacement(): string { return $this->xaxisTickPlacement; } - /** - * Set the xaxis min. - * - * @param int $xaxisMin - * - * @return this - */ - public function setXaxisMin($xaxisMin) :Charts + public function setXaxisMin(int $xaxisMin): Chart { $this->xaxisMin = $xaxisMin; @@ -257,22 +125,12 @@ public function setXaxisMin($xaxisMin) :Charts return $this; } - /** - * @return int - */ - public function getXaxisMin() + public function getXaxisMin(): int { return $this->xaxisMin; } - /** - * Set the xaxis max. - * - * @param int $xaxisMax - * - * @return this - */ - public function setXaxisMax($xaxisMax) :Charts + public function setXaxisMax(int $xaxisMax): Chart { $this->xaxisMax = $xaxisMax; @@ -285,22 +143,12 @@ public function setXaxisMax($xaxisMax) :Charts return $this; } - /** - * @return int - */ - public function getXaxisMax() + public function getXaxisMax(): int { return $this->xaxisMax; } - /** - * Set the xaxis range. - * - * @param int $xaxisRange - * - * @return this - */ - public function setXaxisRange($xaxisRange) :Charts + public function setXaxisRange(int $xaxisRange): Chart { $this->xaxisRange = $xaxisRange; @@ -313,22 +161,12 @@ public function setXaxisRange($xaxisRange) :Charts return $this; } - /** - * @return int - */ - public function getXaxisRange() + public function getXaxisRange(): int { return $this->xaxisRange; } - /** - * Set the xaxis floating. - * - * @param boolean $xaxisFloating - * - * @return this - */ - public function setXaxisFloating($xaxisFloating) :Charts + public function setXaxisFloating(bool $xaxisFloating): Chart { $this->xaxisFloating = $xaxisFloating; @@ -341,22 +179,12 @@ public function setXaxisFloating($xaxisFloating) :Charts return $this; } - /** - * @return boolean - */ - public function getXaxisFloating() + public function getXaxisFloating(): bool { return $this->xaxisFloating; } - /** - * Set the xaxis decimalsInFloat. - * - * @param string $xaxisDecimalsInFloat - * - * @return this - */ - public function setXaxisDecimalsInFloat($xaxisDecimalsInFloat) :Charts + public function setXaxisDecimalsInFloat(int $xaxisDecimalsInFloat): Chart { $this->xaxisDecimalsInFloat = $xaxisDecimalsInFloat; @@ -369,22 +197,12 @@ public function setXaxisDecimalsInFloat($xaxisDecimalsInFloat) :Charts return $this; } - /** - * @return string - */ - public function getXaxisDecimalsInFloat() + public function getXaxisDecimalsInFloat(): int { return $this->xaxisDecimalsInFloat; } - /** - * Set the xaxis overwriteCategories. - * - * @param array $xaxisOverwriteCategories - * - * @return this - */ - public function setXaxisOverwriteCategories($xaxisOverwriteCategories) :Charts + public function setXaxisOverwriteCategories(array $xaxisOverwriteCategories): Chart { $this->xaxisOverwriteCategories = $xaxisOverwriteCategories; @@ -397,22 +215,12 @@ public function setXaxisOverwriteCategories($xaxisOverwriteCategories) :Charts return $this; } - /** - * @return array - */ - public function getXaxisOverwriteCategories() + public function getXaxisOverwriteCategories(): array { return $this->xaxisOverwriteCategories; } - /** - * Set the xaxis position. - * - * @param boolean $xaxisPosition - * - * @return this - */ - public function setXaxisPosition($xaxisPosition) :Charts + public function setXaxisPosition(string $xaxisPosition): Chart { $this->xaxisPosition = $xaxisPosition; @@ -425,22 +233,12 @@ public function setXaxisPosition($xaxisPosition) :Charts return $this; } - /** - * @return boolean - */ - public function getXaxisPosition() + public function getXaxisPosition(): string { return $this->xaxisPosition; } - /** - * Set the xaxis labels. - * - * @param array $xaxisLabels - * - * @return this - */ - public function setXaxisLabels($xaxisLabels) :Charts + public function setXaxisLabels(array $xaxisLabels): Chart { $this->xaxisLabels = $xaxisLabels; @@ -453,22 +251,12 @@ public function setXaxisLabels($xaxisLabels) :Charts return $this; } - /** - * @return array - */ - public function getXaxisLabels() + public function getXaxisLabels(): array { return $this->xaxisLabels; } - /** - * Set the xaxis axisBorder. - * - * @param array $xaxisAxisBorder - * - * @return this - */ - public function setXaxisAxisBorder($xaxisAxisBorder) :Charts + public function setXaxisAxisBorder(array $xaxisAxisBorder): Chart { $this->xaxisAxisBorder = $xaxisAxisBorder; @@ -481,22 +269,12 @@ public function setXaxisAxisBorder($xaxisAxisBorder) :Charts return $this; } - /** - * @return array - */ - public function getXaxisAxisBorder() + public function getXaxisAxisBorder(): array { return $this->xaxisAxisBorder; } - /** - * Set the xaxis axisTicks. - * - * @param array $xaxisAxisTicks - * - * @return this - */ - public function setXaxisAxisTicks($xaxisAxisTicks) :Charts + public function setXaxisAxisTicks(array $xaxisAxisTicks): Chart { $this->xaxisAxisTicks = $xaxisAxisTicks; @@ -509,22 +287,12 @@ public function setXaxisAxisTicks($xaxisAxisTicks) :Charts return $this; } - /** - * @return array - */ - public function getXaxisAxisTicks() + public function getXaxisAxisTicks(): array { return $this->xaxisAxisTicks; } - /** - * Set the xaxis title. - * - * @param array $xaxisTitle - * - * @return this - */ - public function setXaxisTitle($xaxisTitle) :Charts + public function setXaxisTitle(array $xaxisTitle): Chart { $this->xaxisTitle = $xaxisTitle; @@ -537,22 +305,12 @@ public function setXaxisTitle($xaxisTitle) :Charts return $this; } - /** - * @return array - */ - public function getXaxisTitle() + public function getXaxisTitle(): array { return $this->xaxisTitle; } - /** - * Set the xaxis crosshairs. - * - * @param array $xaxisCrosshairs - * - * @return this - */ - public function setXaxisCrosshairs($xaxisCrosshairs) :Charts + public function setXaxisCrosshairs(array $xaxisCrosshairs): Chart { $this->xaxisCrosshairs = $xaxisCrosshairs; @@ -565,22 +323,12 @@ public function setXaxisCrosshairs($xaxisCrosshairs) :Charts return $this; } - /** - * @return array - */ - public function getXaxisCrosshairs() + public function getXaxisCrosshairs(): array { return $this->xaxisCrosshairs; } - /** - * Set the xaxis tooltip. - * - * @param boolean $xaxisTooltip - * - * @return this - */ - public function setXaxisTooltip($xaxisTooltip) :Charts + public function setXaxisTooltip(array $xaxisTooltip): Chart { $this->xaxisTooltip = $xaxisTooltip; @@ -593,10 +341,7 @@ public function setXaxisTooltip($xaxisTooltip) :Charts return $this; } - /** - * @return boolean - */ - public function getXaxisTooltip() + public function getXaxisTooltip(): array { return $this->xaxisTooltip; } diff --git a/src/Options/Yaxis.php b/src/Options/Yaxis.php index 206070b..98337ba 100644 --- a/src/Options/Yaxis.php +++ b/src/Options/Yaxis.php @@ -6,154 +6,47 @@ trait Yaxis { - /** - * Stores the show of the yaxis. - * - * @var boolean - */ - public $yaxisShow = true; - - /** - * Stores the showAlways of the yaxis. - * - * @var boolean - */ - public $yaxisShowAlways = true; - - /** - * Stores the showForNullSeries of the yaxis. - * - * @var boolean - */ - public $yaxisShowForNullSeries = true; - - /** - * Stores the seriesName of the yaxis. - * - * @var string - */ - public $yaxisSeriesName = ''; - - /** - * Stores the opposite of the yaxis. - * - * @var boolean - */ - public $yaxisOpposite = false; - - /** - * Stores the reversed of the yaxis. - * - * @var boolean - */ - public $yaxisReversed = false; - - /** - * Stores the logarithmic of the yaxis. - * - * @var boolean - */ - public $yaxisLogarithmic = false; - - /** - * Stores the logBase of the yaxis. - * - * @var int - */ - public $yaxisLogBase = 10; - - /** - * Stores the tickAmount of the yaxis. - * - * @var int - */ - public $yaxisTickAmount = 6; - - /** - * Stores the min of the yaxis. - * - * @var int - */ - public $yaxisMin = 6; - - /** - * Stores the max of the yaxis. - * - * @var int - */ - public $yaxisMax = 6; - - /** - * Stores the forceNiceScale of the yaxis. - * - * @var boolean - */ - public $yaxisForceNiceScale = false; - - /** - * Stores the floating of the yaxis. - * - * @var boolean - */ - public $yaxisFloating = false; - - /** - * Stores the decimalsInFloat of the yaxis. - * - * @var string - */ - public $yaxisDecimalsInFloat = ''; - - /** - * Stores the labels of the yaxis. - * - * @var array - */ - public $yaxisLabels = []; - - /** - * Stores the axisBorder of the yaxis. - * - * @var array - */ - public $yaxisAxisBorder = []; - - /** - * Stores the axisTicks of the yaxis. - * - * @var array - */ - public $yaxisAxisTicks = []; - - /** - * Stores the title of the yaxis. - * - * @var array - */ - public $yaxisTitle = []; - - /** - * Stores the crosshairs of the yaxis. - * - * @var array - */ - public $yaxisCrosshairs = []; - - /** - * Stores the tooltip of the yaxis. - * - * @var array - */ - public $yaxisTooltip = []; - - /** - * Set the yaxis show. - * - * @param boolean $yaxisShow - * - * @return this - */ - public function setYaxisShow($yaxisShow) :Charts + public bool $yaxisShow = true; + + public bool $yaxisShowAlways = true; + + public bool $yaxisShowForNullSeries = true; + + public string $yaxisSeriesName = ''; + + public bool $yaxisOpposite = false; + + public bool $yaxisReversed = false; + + public bool $yaxisLogarithmic = false; + + public int $yaxisLogBase = 10; + + public int $yaxisTickAmount = 6; + + public int $yaxisMin = 6; + + public int $yaxisMax = 6; + + public bool $yaxisForceNiceScale = false; + + public bool $yaxisFloating = false; + + public int $yaxisDecimalsInFloat; + + public array $yaxisLabels = []; + + public array$yaxisAxisBorder = []; + + public array $yaxisAxisTicks = []; + + public array $yaxisTitle = []; + + public array $yaxisCrosshairs = []; + + public array $yaxisTooltip = []; + + public function setYaxisShow(bool $yaxisShow): Chart { $this->yaxisShow = $yaxisShow; @@ -166,22 +59,12 @@ public function setYaxisShow($yaxisShow) :Charts return $this; } - /** - * @return boolean - */ - public function getYaxisShow() + public function getYaxisShow(): bool { return $this->yaxisShow; } - /** - * Set the yaxis showAlways. - * - * @param boolean $yaxisShowAlways - * - * @return this - */ - public function setYaxisShowAlways($yaxisShowAlways) :Charts + public function setYaxisShowAlways(bool $yaxisShowAlways): Chart { $this->yaxisShowAlways = $yaxisShowAlways; @@ -194,22 +77,12 @@ public function setYaxisShowAlways($yaxisShowAlways) :Charts return $this; } - /** - * @return boolean - */ - public function getYaxisShowAlways() + public function getYaxisShowAlways(): bool { return $this->yaxisShowAlways; } - /** - * Set the yaxis showForNullSeries. - * - * @param boolean $yaxisShowForNullSeries - * - * @return this - */ - public function setYaxisShowForNullSeries($yaxisShowForNullSeries) :Charts + public function setYaxisShowForNullSeries(bool $yaxisShowForNullSeries): Chart { $this->yaxisShowForNullSeries = $yaxisShowForNullSeries; @@ -222,22 +95,12 @@ public function setYaxisShowForNullSeries($yaxisShowForNullSeries) :Charts return $this; } - /** - * @return boolean - */ - public function getYaxisShowForNullSeries() + public function getYaxisShowForNullSeries(): bool { return $this->yaxisShowForNullSeries; } - /** - * Set the yaxis seriesName. - * - * @param string $yaxisSeriesName - * - * @return this - */ - public function setYaxisSeriesName($yaxisSeriesName) :Charts + public function setYaxisSeriesName(string $yaxisSeriesName): Chart { $this->yaxisSeriesName = $yaxisSeriesName; @@ -250,22 +113,12 @@ public function setYaxisSeriesName($yaxisSeriesName) :Charts return $this; } - /** - * @return string - */ - public function getYaxisSeriesName() + public function getYaxisSeriesName(): string { return $this->yaxisSeriesName; } - /** - * Set the yaxis opposite. - * - * @param boolean $yaxisOpposite - * - * @return this - */ - public function setYaxisOpposite($yaxisOpposite) :Charts + public function setYaxisOpposite(bool $yaxisOpposite): Chart { $this->yaxisOpposite = $yaxisOpposite; @@ -278,22 +131,12 @@ public function setYaxisOpposite($yaxisOpposite) :Charts return $this; } - /** - * @return boolean - */ - public function getYaxisOpposite() + public function getYaxisOpposite(): bool { return $this->yaxisOpposite; } - /** - * Set the yaxis reversed. - * - * @param boolean $yaxisReversed - * - * @return this - */ - public function setYaxisReversed($yaxisReversed) :Charts + public function setYaxisReversed(bool $yaxisReversed): Chart { $this->yaxisReversed = $yaxisReversed; @@ -306,22 +149,12 @@ public function setYaxisReversed($yaxisReversed) :Charts return $this; } - /** - * @return boolean - */ - public function getYaxisReversed() + public function getYaxisReversed(): bool { return $this->yaxisReversed; } - /** - * Set the yaxis logarithmic. - * - * @param boolean $yaxisLogarithmic - * - * @return this - */ - public function setYaxisLogarithmic($yaxisLogarithmic) :Charts + public function setYaxisLogarithmic(bool $yaxisLogarithmic): Chart { $this->yaxisLogarithmic = $yaxisLogarithmic; @@ -334,22 +167,12 @@ public function setYaxisLogarithmic($yaxisLogarithmic) :Charts return $this; } - /** - * @return boolean - */ - public function getYaxisLogarithmic() + public function getYaxisLogarithmic(): bool { return $this->yaxisLogarithmic; } - /** - * Set the yaxis logBase. - * - * @param int $yaxisLogBase - * - * @return this - */ - public function setYaxisLogBase($yaxisLogBase) :Charts + public function setYaxisLogBase(int $yaxisLogBase): Chart { $this->yaxisLogBase = $yaxisLogBase; @@ -362,22 +185,12 @@ public function setYaxisLogBase($yaxisLogBase) :Charts return $this; } - /** - * @return int - */ - public function getYaxisLogBase() + public function getYaxisLogBase(): int { return $this->yaxisLogBase; } - /** - * Set the yaxis tickAmount. - * - * @param int $yaxisTickAmount - * - * @return this - */ - public function setYaxisTickAmount($yaxisTickAmount) :Charts + public function setYaxisTickAmount(int $yaxisTickAmount): Chart { $this->yaxisTickAmount = $yaxisTickAmount; @@ -390,22 +203,12 @@ public function setYaxisTickAmount($yaxisTickAmount) :Charts return $this; } - /** - * @return int - */ - public function getYaxisTickAmount() + public function getYaxisTickAmount(): int { return $this->yaxisTickAmount; } - /** - * Set the yaxis min. - * - * @param int $yaxisMin - * - * @return this - */ - public function setYaxisMin($yaxisMin) :Charts + public function setYaxisMin(int $yaxisMin): Chart { $this->yaxisMin = $yaxisMin; @@ -418,22 +221,12 @@ public function setYaxisMin($yaxisMin) :Charts return $this; } - /** - * @return int - */ - public function getYaxisMin() + public function getYaxisMin(): int { return $this->yaxisMin; } - /** - * Set the yaxis max. - * - * @param int $yaxisMax - * - * @return this - */ - public function setYaxisMax($yaxisMax) :Charts + public function setYaxisMax(int $yaxisMax): Chart { $this->yaxisMax = $yaxisMax; @@ -446,22 +239,12 @@ public function setYaxisMax($yaxisMax) :Charts return $this; } - /** - * @return int - */ - public function getYaxisMax() + public function getYaxisMax(): int { return $this->yaxisMax; } - /** - * Set the yaxis forceNiceScale. - * - * @param boolean $yaxisForceNiceScale - * - * @return this - */ - public function setYaxisForceNiceScale($yaxisForceNiceScale) :Charts + public function setYaxisForceNiceScale(bool $yaxisForceNiceScale): Chart { $this->yaxisForceNiceScale = $yaxisForceNiceScale; @@ -474,22 +257,12 @@ public function setYaxisForceNiceScale($yaxisForceNiceScale) :Charts return $this; } - /** - * @return boolean - */ - public function getYaxisForceNiceScale() + public function getYaxisForceNiceScale(): bool { return $this->yaxisForceNiceScale; } - /** - * Set the yaxis floating. - * - * @param boolean $yaxisFloating - * - * @return this - */ - public function setYaxisFloating($yaxisFloating) :Charts + public function setYaxisFloating(bool $yaxisFloating): Chart { $this->yaxisFloating = $yaxisFloating; @@ -502,22 +275,12 @@ public function setYaxisFloating($yaxisFloating) :Charts return $this; } - /** - * @return boolean - */ - public function getYaxisFloating() + public function getYaxisFloating(): bool { return $this->yaxisFloating; } - /** - * Set the yaxis decimalsInFloat. - * - * @param string $yaxisDecimalsInFloat - * - * @return this - */ - public function setYaxisDecimalsInFloat($yaxisDecimalsInFloat) :Charts + public function setYaxisDecimalsInFloat(int $yaxisDecimalsInFloat): Chart { $this->yaxisDecimalsInFloat = $yaxisDecimalsInFloat; @@ -530,22 +293,12 @@ public function setYaxisDecimalsInFloat($yaxisDecimalsInFloat) :Charts return $this; } - /** - * @return string - */ - public function getYaxisDecimalsInFloat() + public function getYaxisDecimalsInFloat(): int { return $this->yaxisDecimalsInFloat; } - /** - * Set the yaxis labels. - * - * @param array $yaxisLabels - * - * @return this - */ - public function setYaxisLabels($yaxisLabels) :Charts + public function setYaxisLabels(array $yaxisLabels): Chart { $this->yaxisLabels = $yaxisLabels; @@ -558,22 +311,12 @@ public function setYaxisLabels($yaxisLabels) :Charts return $this; } - /** - * @return array - */ - public function getYaxisLabels() + public function getYaxisLabels(): array { return $this->yaxisLabels; } - /** - * Set the yaxis axisBorder. - * - * @param array $yaxisAxisBorder - * - * @return this - */ - public function setYaxisAxisBorder($yaxisAxisBorder) :Charts + public function setYaxisAxisBorder(array $yaxisAxisBorder): Chart { $this->yaxisAxisBorder = $yaxisAxisBorder; @@ -586,22 +329,12 @@ public function setYaxisAxisBorder($yaxisAxisBorder) :Charts return $this; } - /** - * @return array - */ - public function getYaxisAxisBorder() + public function getYaxisAxisBorder(): array { return $this->yaxisAxisBorder; } - /** - * Set the yaxis axisTicks. - * - * @param array $yaxisAxisTicks - * - * @return this - */ - public function setYaxisAxisTicks($yaxisAxisTicks) :Charts + public function setYaxisAxisTicks(array $yaxisAxisTicks): Chart { $this->yaxisAxisTicks = $yaxisAxisTicks; @@ -614,22 +347,12 @@ public function setYaxisAxisTicks($yaxisAxisTicks) :Charts return $this; } - /** - * @return array - */ - public function getYaxisAxisTicks() + public function getYaxisAxisTicks(): array { return $this->yaxisAxisTicks; } - /** - * Set the yaxis title. - * - * @param array $yaxisTitle - * - * @return this - */ - public function setYaxisTitle($yaxisTitle) :Charts + public function setYaxisTitle(array $yaxisTitle): Chart { $this->yaxisTitle = $yaxisTitle; @@ -642,22 +365,12 @@ public function setYaxisTitle($yaxisTitle) :Charts return $this; } - /** - * @return array - */ - public function getYaxisTitle() + public function getYaxisTitle(): array { return $this->yaxisTitle; } - /** - * Set the yaxis crosshairs. - * - * @param array $yaxisCrosshairs - * - * @return this - */ - public function setYaxisCrosshairs($yaxisCrosshairs) :Charts + public function setYaxisCrosshairs(array $yaxisCrosshairs): Chart { $this->yaxisCrosshairs = $yaxisCrosshairs; @@ -670,22 +383,12 @@ public function setYaxisCrosshairs($yaxisCrosshairs) :Charts return $this; } - /** - * @return array - */ - public function getYaxisCrosshairs() + public function getYaxisCrosshairs(): array { return $this->yaxisCrosshairs; } - /** - * Set the yaxis tooltip. - * - * @param boolean $yaxisTooltip - * - * @return this - */ - public function setYaxisTooltip($yaxisTooltip) :Charts + public function setYaxisTooltip(array $yaxisTooltip): Chart { $this->yaxisTooltip = $yaxisTooltip; @@ -698,10 +401,7 @@ public function setYaxisTooltip($yaxisTooltip) :Charts return $this; } - /** - * @return boolean - */ - public function getYaxisTooltip() + public function getYaxisTooltip(): array { return $this->yaxisTooltip; } diff --git a/src/Provider.php b/src/Provider.php index 3ae47f9..c251955 100644 --- a/src/Provider.php +++ b/src/Provider.php @@ -10,10 +10,8 @@ class Provider extends ServiceProvider { /** * Register the application services. - * - * @return void */ - public function register() + public function register(): void { $this->app->alias(Charts::class, 'apexcharts'); @@ -22,10 +20,8 @@ public function register() /** * When this method is apply we have all laravel providers and methods available - * - * @return void */ - public function boot() + public function boot(): void { $this->loadViewsFrom(__DIR__ . '/Views', 'apexcharts'); @@ -38,7 +34,7 @@ public function boot() $this->registerBladeDirectives(); } - public function registerBladeDirectives() + public function registerBladeDirectives(): void { $this->app->afterResolving('blade.compiler', function (BladeCompiler $bladeCompiler) { $bladeCompiler->directive('apexchartsScripts', function ($expression) { diff --git a/src/Support/DatasetClass.php b/src/Support/DatasetClass.php index e6b2cd4..4c0b208 100644 --- a/src/Support/DatasetClass.php +++ b/src/Support/DatasetClass.php @@ -6,48 +6,16 @@ class DatasetClass { - /** - * Defines the name of the dataset. - * - * @var string - */ - public $name = 'Undefined'; + public string $name = 'Undefined'; - /** - * Defines the dataset type. - * - * @var string - */ - public $type = ''; + public string $type = ''; - /** - * Stores the dataset data. - * - * @var array - */ - public $data = []; + public array $data = []; - /** - * Stores the dataset options. - * - * @var array - */ - public $options = []; + public array $options = []; - /** - * Defines the undefined color. - * - * @var string - */ - public $undefinedColor = '#22292F'; + public string $undefinedColor = '#22292F'; - /** - * Creates a new dataset with the given values. - * - * @param string $name - * @param string $type - * @param array $values - */ public function __construct(string $name, string $type, array $data) { $this->name = $name; @@ -57,28 +25,14 @@ public function __construct(string $name, string $type, array $data) return $this; } - /** - * Set the dataset type. - * - * @param string $type - * - * @return self - */ - public function type(string $type) + public function type(string $type): DatasetClass { $this->type = $type; return $this; } - /** - * Set the dataset values. - * - * @param array|Collection $values - * - * @return self - */ - public function data($data) + public function data(array|Collection $data): DatasetClass { if ($data instanceof Collection) { $data = $data->toArray(); @@ -89,15 +43,7 @@ public function data($data) return $this; } - /** - * Set the dataset options. - * - * @param array|Collection $options - * @param bool $overwrite - * - * @return self - */ - public function options($options, bool $overwrite = false) + public function options(array|Collection $options, bool $overwrite = false): DatasetClass { if ($overwrite) { $this->options = $options; @@ -110,13 +56,8 @@ public function options($options, bool $overwrite = false) /** * Matches the data of the dataset with the given number. - * - * @param int $data - * @param bool $strict - * - * @return void */ - public function matchdata(int $data, bool $strict = false) + public function matchdata(int $data, bool $strict = false): void { while (count($this->data) < $data) { array_push($this->data, 0); diff --git a/src/Traits/Formatter.php b/src/Traits/Formatter.php index d6303e7..62822d4 100644 --- a/src/Traits/Formatter.php +++ b/src/Traits/Formatter.php @@ -6,24 +6,20 @@ trait Formatter { public function toJson() { - $options = $this->getOptions(); - return response()->json([ - 'id' => $this->id(), - 'options' => $options, + 'id' => $this->id(), + 'options' => $this->getOptions(), ]); } - public function toVue() :array + public function toVue(): array { - $options = $this->getOptions(); - return [ - 'height' => $this->getHeight(), - 'width' => $this->getWidth(), - 'type' => $this->getType(), - 'options' => $options, - 'series' => json_decode($this->getSeries()), + 'height' => $this->getHeight(), + 'width' => $this->getWidth(), + 'type' => $this->getType(), + 'options' => $this->getOptions(), + 'series' => json_decode($this->getSeries()), ]; } } diff --git a/src/Traits/Types.php b/src/Traits/Types.php index e440f5d..fffa9e4 100644 --- a/src/Traits/Types.php +++ b/src/Traits/Types.php @@ -15,52 +15,52 @@ trait Types { - public function area() :Area + public function area(): Area { return new Area(); } - public function bar() :Bar + public function bar(): Bar { return new Bar(); } - public function donut() :Donut + public function donut(): Donut { return new Donut(); } - public function heatMap() :HeatMap + public function heatMap(): HeatMap { return new HeatMap(); } - public function horizontalBar() :HorizontalBar + public function horizontalBar(): HorizontalBar { return new HorizontalBar(); } - public function line() :Line + public function line(): Line { return new Line(); } - public function pie() :Pie + public function pie(): Pie { return new Pie(); } - public function polarArea() :PolarArea + public function polarArea(): PolarArea { return new PolarArea(); } - public function radar() :Radar + public function radar(): Radar { return new Radar(); } - public function radial() :Radial + public function radial(): Radial { return new Radial(); } diff --git a/src/Types/Area.php b/src/Types/Area.php index fae8453..ce95a65 100644 --- a/src/Types/Area.php +++ b/src/Types/Area.php @@ -3,6 +3,7 @@ namespace Akaunting\Apexcharts\Types; use Akaunting\Apexcharts\Charts; +use Illuminate\Support\Collection; class Area extends Charts { @@ -13,7 +14,7 @@ public function __construct() $this->setType('area'); } - public function addArea(string $name, $data) :Area + public function addArea(string $name, array|Collection $data): Area { $type = $this->getType(); diff --git a/src/Types/Bar.php b/src/Types/Bar.php index 2cfebbc..d962e26 100644 --- a/src/Types/Bar.php +++ b/src/Types/Bar.php @@ -3,6 +3,7 @@ namespace Akaunting\Apexcharts\Types; use Akaunting\Apexcharts\Charts; +use Illuminate\Support\Collection; class Bar extends Charts { @@ -13,7 +14,7 @@ public function __construct() $this->setType('bar'); } - public function addBar(string $name, $data) :Bar + public function addBar(string $name, array|Collection $data): Bar { $type = $this->getType(); diff --git a/src/Types/Donut.php b/src/Types/Donut.php index 3a47bdb..35f1cd8 100644 --- a/src/Types/Donut.php +++ b/src/Types/Donut.php @@ -13,7 +13,7 @@ public function __construct() $this->setType('donut'); } - public function addPieces(array $data) :Donut + public function addPieces(array $data): Donut { return $this->setSeries($data); } diff --git a/src/Types/HeatMap.php b/src/Types/HeatMap.php index e5d2d3b..73190af 100644 --- a/src/Types/HeatMap.php +++ b/src/Types/HeatMap.php @@ -3,6 +3,7 @@ namespace Akaunting\Apexcharts\Types; use Akaunting\Apexcharts\Charts; +use Illuminate\Support\Collection; class HeatMap extends Charts { @@ -13,7 +14,7 @@ public function __construct() $this->setType('heatmap'); } - public function addHeat(string $name, $data) :HeatMap + public function addHeat(string $name, array|Collection $data): HeatMap { $type = $this->getType(); diff --git a/src/Types/HorizontalBar.php b/src/Types/HorizontalBar.php index 8bfc410..4151e1a 100644 --- a/src/Types/HorizontalBar.php +++ b/src/Types/HorizontalBar.php @@ -3,6 +3,7 @@ namespace Akaunting\Apexcharts\Types; use Akaunting\Apexcharts\Charts; +use Illuminate\Support\Collection; class HorizontalBar extends Charts { @@ -13,11 +14,11 @@ public function __construct() $this->setType('bar'); $this->setBar([ - 'horizontal' => true + 'horizontal' => true, ]); } - public function addBar(string $name, $data) :HorizontalBar + public function addBar(string $name, array|Collection $data): HorizontalBar { $type = $this->getType(); diff --git a/src/Types/Line.php b/src/Types/Line.php index afc1249..f853f14 100644 --- a/src/Types/Line.php +++ b/src/Types/Line.php @@ -3,6 +3,7 @@ namespace Akaunting\Apexcharts\Types; use Akaunting\Apexcharts\Charts; +use Illuminate\Support\Collection; class Line extends Charts { @@ -13,7 +14,7 @@ public function __construct() $this->setType('line'); } - public function addLine(string $name, $data) :Line + public function addLine(string $name, array|Collection $data): Line { $type = $this->getType(); diff --git a/src/Types/Pie.php b/src/Types/Pie.php index 7703684..0319d0c 100644 --- a/src/Types/Pie.php +++ b/src/Types/Pie.php @@ -13,7 +13,7 @@ public function __construct() $this->setType('pie'); } - public function addPieces(array $data) :Pie + public function addPieces(array $data): Pie { return $this->setSeries($data); } diff --git a/src/Types/PolarArea.php b/src/Types/PolarArea.php index fee10df..9d3ce1b 100644 --- a/src/Types/PolarArea.php +++ b/src/Types/PolarArea.php @@ -13,7 +13,7 @@ public function __construct() $this->setType('polarArea'); } - public function addPolarAreas(array $data) :PolarArea + public function addPolarAreas(array $data): PolarArea { return $this->setSeries($data); } diff --git a/src/Types/Radar.php b/src/Types/Radar.php index c6d24ab..be76b7f 100644 --- a/src/Types/Radar.php +++ b/src/Types/Radar.php @@ -3,6 +3,7 @@ namespace Akaunting\Apexcharts\Types; use Akaunting\Apexcharts\Charts; +use Illuminate\Support\Collection; class Radar extends Charts { @@ -13,7 +14,7 @@ public function __construct() $this->setType('radar'); } - public function addArea(string $name, $data) :Radar + public function addArea(string $name, array|Collection $data): Radar { $type = $this->getType(); diff --git a/src/Types/Radial.php b/src/Types/Radial.php index fcd76de..8dfd1f3 100644 --- a/src/Types/Radial.php +++ b/src/Types/Radial.php @@ -13,7 +13,7 @@ public function __construct() $this->setType('radialBar'); } - public function addRings(array $data) :Radial + public function addRings(array $data): Radial { return $this->setSeries($data); }