Skip to content

Commit

Permalink
Merge pull request #18 from drps/master
Browse files Browse the repository at this point in the history
tooltip support enabled
  • Loading branch information
julles authored Oct 1, 2019
2 parents efe4734 + dbcba53 commit 03622a5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Classes/Presenters/ChartPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,13 @@ public function plotOptions($plotOptions = [])
return $this;
}

public function tooltip($tooltip = [])
{
$this->transform->tooltip = $tooltip;

return $this;
}

public function series($series = [])
{
$this->transform->series = $series;
Expand Down
12 changes: 12 additions & 0 deletions src/Classes/Presenters/JsTransformerPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class JsTransformerPresenter
public $legend = [];
public $plotOptions = [];
public $series = [];
public $tooltip = [];
public $chart = [];
public $colors = [];
public $credits = [];
Expand Down Expand Up @@ -75,6 +76,15 @@ public function encode_plot_options()
return $this;
}

public function encode_tooltip()
{
$data = $this->tooltip;

$this->tooltip = !empty($data) ? 'tooltip: '.json_encode($data).',' : null;

return $this;
}

public function encode_series()
{
$data = $this->series;
Expand Down Expand Up @@ -132,6 +142,7 @@ public function transform()
$this->encode_x_axis();
$this->encode_legend();
$this->encode_plot_options();
$this->encode_tooltip();
$this->encode_series();
$this->encode_chart();
$this->encode_colors();
Expand All @@ -143,6 +154,7 @@ public function transform()
$this->xAxis.
$this->legend.
$this->plotOptions.
$this->tooltip.
$this->series.
$this->chart.
$this->colors.
Expand Down

0 comments on commit 03622a5

Please sign in to comment.