diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..13ee2b0 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "nuxt.isNuxtApp": false +} \ No newline at end of file diff --git a/src/LarapexChart.php b/src/LarapexChart.php index 9e15abc..ecaccd0 100644 --- a/src/LarapexChart.php +++ b/src/LarapexChart.php @@ -1,9 +1,11 @@ publishes([ $this->packageBasePath('config/larapex-charts.php') => base_path('config/larapex-charts.php') - ], 'larapex-charts-config'); + ], 'larapex-charts-config'); + + $this->publishes([ + $this->packageBasePath('stubs/Console/Commands') => app_path('Console/Commands') + ], 'larapex-charts-commands'); $this->publishes([ $this->packageBasePath('stubs/stubs') => base_path('stubs') diff --git a/src/Traits/HasOptions.php b/src/Traits/HasOptions.php new file mode 100644 index 0000000..7246c01 --- /dev/null +++ b/src/Traits/HasOptions.php @@ -0,0 +1,56 @@ +options ? array_merge_recursive($this->getDefaultOption() ,$this->options) : $this->getDefaultOption(); + } + + /** + * Set the value of options + * + * @return self + */ + public function setOptions($options) + { + $this->options = $options; + + return $this; + } + + private function getDefaultOption(){ + return [ + 'chart' => [ + 'type' => $this->type(), + 'height' => $this->height(), + 'width' => $this->width(), + 'toolbar' => json_decode($this->toolbar()), + 'zoom' => json_decode($this->zoom()), + 'fontFamily' => json_decode($this->fontFamily()), + 'foreColor' => $this->foreColor(), + ], + 'plotOptions' => [ + 'bar' => json_decode($this->horizontal()), + ], + 'colors' => json_decode($this->colors()), + 'series' => json_decode($this->dataset()), + 'dataLabels' => json_decode($this->dataLabels()), + 'title' => [ + 'text' => $this->title() + ], + 'subtitle' => [ + 'text' => $this->subtitle() ? $this->subtitle() : '', + 'align' => $this->subtitlePosition() ? $this->subtitlePosition() : '', + ], + 'xaxis' => [ + 'categories' => json_decode($this->xAxis()), + ], + 'grid' => json_decode($this->grid()), + 'markers' => json_decode($this->markers()), + ]; + } +} \ No newline at end of file