diff --git a/src/Classes/Presenters/ChartPresenter.php b/src/Classes/Presenters/ChartPresenter.php index f546cef..72b7eb6 100644 --- a/src/Classes/Presenters/ChartPresenter.php +++ b/src/Classes/Presenters/ChartPresenter.php @@ -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; diff --git a/src/Classes/Presenters/JsTransformerPresenter.php b/src/Classes/Presenters/JsTransformerPresenter.php index a95495a..f665334 100644 --- a/src/Classes/Presenters/JsTransformerPresenter.php +++ b/src/Classes/Presenters/JsTransformerPresenter.php @@ -12,6 +12,7 @@ class JsTransformerPresenter public $legend = []; public $plotOptions = []; public $series = []; + public $tooltip = []; public $chart = []; public $colors = []; public $credits = []; @@ -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; @@ -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(); @@ -143,6 +154,7 @@ public function transform() $this->xAxis. $this->legend. $this->plotOptions. + $this->tooltip. $this->series. $this->chart. $this->colors.