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 $_xmetric = '';
protected $_ymetric = ''; protected $_ymetric = '';
protected $_tooltip = ''; protected $_tooltip = '';
protected $_pointurl = ''; // URL when clicking on a plot point.
// Colors to use for series // Colors to use for series
private $_series_colours = array('AAACCC','E0E0E0','CCC888','EEEBBB','666CCC','888888'); private $_series_colours = array('AAACCC','E0E0E0','CCC888','EEEBBB','666CCC','888888');
@ -43,6 +44,8 @@ abstract class HighChart {
break; break;
case 'height': $this->_height = array_shift($args); case 'height': $this->_height = array_shift($args);
break; break;
case 'pointurl': $this->_pointurl = array_shift($args);
break;
case 'subtitle': $this->_subtitle = array_shift($args); case 'subtitle': $this->_subtitle = array_shift($args);
break; break;
case 'title': $this->_title = array_shift($args); case 'title': $this->_title = array_shift($args);

View File

@ -80,6 +80,19 @@ $(document).ready(function() {
credits: { credits: {
enabled: false enabled: false
}, },
plotOptions: {
series: {
cursor: 'pointer',
point: {
events: {
click: function () {
location.href = site_url+'".$this->_pointurl."'+this.options.id;
}
}
}
}
},
series: ".$this->json().", series: ".$this->json().",
}); });
});", });",

View File

@ -18,9 +18,17 @@ abstract class HighChart_Type {
protected $_soptions = array(); protected $_soptions = array();
protected $_sorder = 0; protected $_sorder = 0;
protected $_stitle = ''; protected $_stitle = '';
protected $_sid = '';
public function __call($name,$args) { public function __call($name,$args) {
switch ($name) { switch ($name) {
case 'id':
if (! $args)
return $this->_sid;
$this->_sid = array_shift($args);
break;
case 'data': case 'data':
$args = array_shift($args); $args = array_shift($args);

View File

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