From 4bd8d1ffae3d89ee85de63e1a80a3d7aeb7b0fa5 Mon Sep 17 00:00:00 2001 From: Deon George Date: Fri, 22 Nov 2013 15:19:01 +1100 Subject: [PATCH] Added Y Axis Metric Label --- classes/HighChart.php | 3 +++ classes/HighChart/Combo.php | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/classes/HighChart.php b/classes/HighChart.php index 14fe17e..c4b3e88 100644 --- a/classes/HighChart.php +++ b/classes/HighChart.php @@ -20,6 +20,7 @@ abstract class HighChart { // Default chart size. protected $_height = '300'; protected $_width = '575'; + protected $_ymetric = ''; // Colors to use for series private $_series_colours = array('AAACCC','E0E0E0','CCC888','EEEBBB','666CCC','888888'); @@ -40,6 +41,8 @@ abstract class HighChart { break; case 'width': $this->_width = array_shift($args); break; + case 'ymetric': $this->_ymetric = array_shift($args); + break; default: throw new Kohana_Exception('Unknown method :name',array(':name'=>$name)); } diff --git a/classes/HighChart/Combo.php b/classes/HighChart/Combo.php index 8d1a036..18969dc 100644 --- a/classes/HighChart/Combo.php +++ b/classes/HighChart/Combo.php @@ -91,7 +91,7 @@ $(document).ready(function() { }, yAxis: { title: { - text: 'MB' + text: '".$this->_ymetric."' }, labels: { formatter: function() { @@ -102,7 +102,7 @@ $(document).ready(function() { tooltip: { formatter: function() { var s; - s = '' + (this.point.name ? this.point.name+': ' : '') + this.y +' MB'; + s = '' + (this.point.name ? this.point.name+': ' : '') + this.y +' ".$this->_ymetric."'; return s; } },