diff --git a/classes/HighChart.php b/classes/HighChart.php index 1026a75..f3b5348 100644 --- a/classes/HighChart.php +++ b/classes/HighChart.php @@ -24,6 +24,7 @@ abstract class HighChart { protected $_xmetric = ''; protected $_ymetric = ''; protected $_tooltip = ''; + protected $_pointurl = ''; // URL when clicking on a plot point. // Colors to use for series private $_series_colours = array('AAACCC','E0E0E0','CCC888','EEEBBB','666CCC','888888'); @@ -43,6 +44,8 @@ abstract class HighChart { break; case 'height': $this->_height = array_shift($args); break; + case 'pointurl': $this->_pointurl = array_shift($args); + break; case 'subtitle': $this->_subtitle = array_shift($args); break; case 'title': $this->_title = array_shift($args); diff --git a/classes/HighChart/Bubble.php b/classes/HighChart/Bubble.php index 3ddb95d..470d28b 100644 --- a/classes/HighChart/Bubble.php +++ b/classes/HighChart/Bubble.php @@ -80,6 +80,19 @@ $(document).ready(function() { credits: { enabled: false }, + plotOptions: { + series: { + cursor: 'pointer', + point: { + events: { + click: function () { + location.href = site_url+'".$this->_pointurl."'+this.options.id; + } + } + } + } + }, + series: ".$this->json().", }); });", diff --git a/classes/HighChart/Type.php b/classes/HighChart/Type.php index af2f101..5bb6d5a 100644 --- a/classes/HighChart/Type.php +++ b/classes/HighChart/Type.php @@ -18,9 +18,17 @@ abstract class HighChart_Type { protected $_soptions = array(); protected $_sorder = 0; protected $_stitle = ''; + protected $_sid = ''; public function __call($name,$args) { switch ($name) { + case 'id': + if (! $args) + return $this->_sid; + + $this->_sid = array_shift($args); + break; + case 'data': $args = array_shift($args); diff --git a/classes/HighChart/Type/Bubble.php b/classes/HighChart/Type/Bubble.php index 3520fe3..1202697 100644 --- a/classes/HighChart/Type/Bubble.php +++ b/classes/HighChart/Type/Bubble.php @@ -21,6 +21,7 @@ class HighChart_Type_Bubble extends HighChart_Type { $result[$k] = $v; $result['name'] = $this->_stitle; + $result['id'] = $this->_sid; return $result; }