16057,... protected $_sdata = array(); protected $_sindex = NULL; protected $_soptions = array(); protected $_sorder = 0; protected $_stitle = ''; public function __call($name,$args) { switch ($name) { case 'data': if (! $args) return $this->_sdata; $this->_sdata = array_shift($args); break; case 'index': if (! $args) return $this->_sindex; $this->_sindex = array_shift($args); break; case 'name': if (! $args) return $this->_stitle; $this->_stitle = array_shift($args); break; case 'order': if (! $args) return $this->_sorder; $this->_sorder = array_shift($args); break; default: throw new Kohana_Exception('Unknown method :name',array(':name'=>$name)); } return $this; } /** * Incrementally add to a series */ public function series_add($name,$v,$options=array()) { if (! empty($this->_sdata[$name])) throw new Kohana_Exception('Column :column already has some data',array(':column'=>$name)); $this->_sdata[$name] = $v; foreach ($options as $k=>$v) $this->_soptions[$k][$name] = $v; return $this; } /** * Calculate the total of all data in the series */ public function total() { return array_sum($this->_sdata); } }