_divname = array_shift($args); break; case 'height': $this->_height = array_shift($args); break; case 'title': $this->_title = array_shift($args); 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)); } return $this; } /** * Render the URL that generates the graph */ final public function __toString() { try { return (string)$this->render(); } catch (Exception $e) { echo Debug::vars(array('m'=>__METHOD__,'e'=>$e));die(); } } /** * Pick the driver that will render the graph * @param $class The child class to invoke */ final public static function factory($class) { $c = sprintf('%s_%s',get_called_class(),$class); if (! class_exists($c)) throw new Kohana_Exception('Unknown HighChart Type :class',array(':class'=>$class)); else return new $c(); } public function series($type,$axis) { if (! in_array($type,$this->_valid_axis)) throw new Kohana_Exception('Type not allowed for Chart :type',array(':type'=>$type)); $x = 'HighChart_Type_'.ucfirst($type); if (! class_exists($x)) throw new Kohana_Exception('Class does not exist :class',array(':class'=>$x)); if (! isset($this->_series[$axis])) $this->_series[$axis] = array(); $c = count($this->_series[$axis]); $this->_series[$axis][$c] = new $x; return $this->_series[$axis][$c]; } /** * Return the colors that will be used for this series */ protected function series_colour($c) { if (is_null($c)) return NULL; static $colours = NULL; if (is_null($colours)) $colors = count($this->_series_colours); return '#'.$this->_series_colours[$c%$colors]; } } ?>