Skip to content

Commit c33dd36

Browse files
authored
Merge pull request #11 from christopher16/master
Enabled credits and punctuation with accentuation
2 parents a97d8ea + 84bd543 commit c33dd36

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
/vendor/
2+
/.idea

src/Classes/Presenters/ChartPresenter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ public function colors($series = [])
127127
return $this;
128128
}
129129

130-
public function credits($credits = 'false')
130+
public function credits($credits = [])
131131
{
132-
// $this->transform->credits = $credits;
132+
$this->transform->credits = $credits;
133133
return $this;
134134
}
135135

src/Classes/Presenters/JsTransformerPresenter.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class JsTransformerPresenter
1414
public $series = [];
1515
public $chart = [];
1616
public $colors = [];
17-
public $credits = 'false';
17+
public $credits = [];
1818
public $container = 'container';
1919

2020
public function __contruct()
@@ -26,7 +26,7 @@ public function encode_title()
2626
{
2727
$data = $this->title;
2828

29-
$this->title = !empty($data) ? 'title: '.json_encode($data).',' : null;
29+
$this->title = !empty($data) ? 'title: '.json_encode($data, JSON_UNESCAPED_UNICODE).',' : null;
3030

3131
return $this;
3232
}
@@ -35,7 +35,7 @@ public function encode_sub_title()
3535
{
3636
$data = $this->subtitle;
3737

38-
$this->subtitle = !empty($data) ? 'subtitle: '.json_encode($data).',' : null;
38+
$this->subtitle = !empty($data) ? 'subtitle: '.json_encode($data, JSON_UNESCAPED_UNICODE).',' : null;
3939

4040
return $this;
4141
}
@@ -61,7 +61,7 @@ public function encode_legend()
6161
{
6262
$data = $this->legend;
6363

64-
$this->legend = !empty($data) ? 'legend: '.json_encode($data).',' : null;
64+
$this->legend = !empty($data) ? 'legend: '.json_encode($data, JSON_UNESCAPED_UNICODE).',' : null;
6565

6666
return $this;
6767
}
@@ -79,7 +79,7 @@ public function encode_series()
7979
{
8080
$data = $this->series;
8181

82-
$this->series = !empty($data) ? 'series: '.json_encode($data).',' : null;
82+
$this->series = !empty($data) ? 'series: '.json_encode($data, JSON_UNESCAPED_UNICODE).',' : null;
8383

8484
return $this;
8585
}
@@ -88,7 +88,7 @@ public function encode_chart()
8888
{
8989
$data = $this->chart;
9090

91-
$this->chart = !empty($data) ? 'chart: '.json_encode($data).',' : null;
91+
$this->chart = !empty($data) ? 'chart: '.json_encode($data, JSON_UNESCAPED_UNICODE).',' : null;
9292

9393
return $this;
9494
}
@@ -103,7 +103,8 @@ public function encode_colors()
103103

104104
public function credits()
105105
{
106-
$this->credits = 'credits:false,';
106+
$data = $this->credits;
107+
$this->credits = !empty($data)? 'credits: '.json_encode($data, JSON_UNESCAPED_UNICODE).',' : null;
107108

108109
return $this;
109110
}

0 commit comments

Comments
 (0)