Skip to content

Commit

Permalink
set sparkline to be consistent with apexchartsjs library
Browse files Browse the repository at this point in the history
  • Loading branch information
ArielMejiaDev committed Sep 19, 2022
1 parent 88ddc1a commit 8908207
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions src/LarapexChart.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class LarapexChart
protected $toolbar;
protected $zoom;
protected $dataLabels;
protected $sparklines;
protected $sparkline;
private $chartLetters = 'abcdefghijklmnopqrstuvwxyz';

/*
Expand All @@ -55,7 +55,7 @@ public function __construct()
$this->toolbar = json_encode(['show' => false]);
$this->zoom = json_encode(['enabled' => true]);
$this->dataLabels = json_encode(['enabled' => false]);
$this->sparklines = json_encode(['enabled' => false]);
$this->sparkline = json_encode(['enabled' => false]);
$this->fontFamily = config('larapex-charts.font_family');
$this->foreColor = config('larapex-charts.font_color');
return $this;
Expand Down Expand Up @@ -255,9 +255,9 @@ public function setDataLabels(bool $enabled = true) :LarapexChart
return $this;
}

public function setSparklines(bool $enabled = true): LarapexChart
public function setSparkline(bool $enabled = true): LarapexChart
{
$this->sparklines = json_encode(['enabled' => $enabled]);
$this->sparkline = json_encode(['enabled' => $enabled]);
return $this;
}

Expand Down Expand Up @@ -460,9 +460,9 @@ public function dataLabels()
/**
* @return true|boolean
*/
public function sparklines()
public function sparkline()
{
return $this->sparklines;
return $this->sparkline;
}

/*
Expand All @@ -482,7 +482,7 @@ public function toJson()
'zoom' => json_decode($this->zoom()),
'fontFamily' => json_decode($this->fontFamily()),
'foreColor' => $this->foreColor(),
'sparklines' => $this->sparklines(),
'sparkline' => $this->sparkline(),
],
'plotOptions' => [
'bar' => json_decode($this->horizontal()),
Expand Down Expand Up @@ -527,7 +527,7 @@ public function toVue() :array
'zoom' => json_decode($this->zoom()),
'fontFamily' => json_decode($this->fontFamily()),
'foreColor' => $this->foreColor(),
'sparkline' => json_decode($this->sparklines()),
'sparkline' => json_decode($this->sparkline()),
],
'plotOptions' => [
'bar' => json_decode($this->horizontal()),
Expand Down
2 changes: 1 addition & 1 deletion stubs/resources/views/chart/script.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
zoom: {!! $chart->zoom() !!},
fontFamily: '{!! $chart->fontFamily() !!}',
foreColor: '{!! $chart->foreColor() !!}',
sparkline: {!! $chart->sparklines() !!}
sparkline: {!! $chart->sparkline() !!}
},
plotOptions: {
bar: {!! $chart->horizontal() !!}
Expand Down

0 comments on commit 8908207

Please sign in to comment.