Enabled adding URL to bubble

This commit is contained in:
Deon George 2015-09-30 21:33:00 +10:00
parent 409d911fb4
commit 059fa0f543
4 changed files with 25 additions and 0 deletions

View File

@ -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);

View File

@ -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().",
});
});",

View File

@ -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);

View File

@ -21,6 +21,7 @@ class HighChart_Type_Bubble extends HighChart_Type {
$result[$k] = $v;
$result['name'] = $this->_stitle;
$result['id'] = $this->_sid;
return $result;
}