-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from pandigresik/master
add options to custom override config in chart
- Loading branch information
Showing
4 changed files
with
66 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"nuxt.isNuxtApp": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
namespace ArielMejiaDev\LarapexCharts\Traits; | ||
trait HasOptions{ | ||
protected $options; | ||
/** | ||
* Get the value of options | ||
*/ | ||
public function getOptions() | ||
{ | ||
return $this->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()), | ||
]; | ||
} | ||
} |