Skip to content

Commit

Permalink
Merge pull request #54 from Tschucki/dev
Browse files Browse the repository at this point in the history
Add possibility to customize theme
  • Loading branch information
ArielMejiaDev committed Jan 24, 2024
2 parents 5a5bc9b + aa9a899 commit 836ec67
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/LarapexChart.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class LarapexChart
protected string $toolbar;
protected string $zoom;
protected string $dataLabels;
protected string $theme = 'light';
protected string $sparkline;
private string $chartLetters = 'abcdefghijklmnopqrstuvwxyz';

Expand All @@ -61,6 +62,7 @@ public function __construct()
$this->sparkline = json_encode(['enabled' => false]);
$this->fontFamily = config('larapex-charts.font_family');
$this->foreColor = config('larapex-charts.font_color');
return $this;
}

public function pieChart() :PieChart
Expand Down Expand Up @@ -258,6 +260,11 @@ public function setDataLabels(bool $enabled = true) :LarapexChart
return $this;
}

public function setTheme(string $theme) :LarapexChart
{
$this->theme = $theme;
}

public function setSparkline(bool $enabled = true): LarapexChart
{
$this->sparkline = json_encode(['enabled' => $enabled]);
Expand Down Expand Up @@ -435,6 +442,9 @@ public function toJson(): \Illuminate\Http\JsonResponse
'colors' => json_decode($this->colors()),
'series' => json_decode($this->dataset()),
'dataLabels' => json_decode($this->dataLabels()),
'theme' => [
'mode' => $this->theme
],
'title' => [
'text' => $this->title()
],
Expand Down Expand Up @@ -486,6 +496,9 @@ public function toVue() :array
],
'colors' => json_decode($this->colors()),
'dataLabels' => json_decode($this->dataLabels()),
'theme' => [
'mode' => $this->theme
],
'title' => [
'text' => $this->title()
],
Expand Down

0 comments on commit 836ec67

Please sign in to comment.