. */ /** * For more information, please contact */ namespace Goat1000\SVGGraph; /** * Class for axis grid points */ class GridPoint { public $position; public $value; public $item = null; protected $text = []; public function __construct($position, $text, $value, $item = null) { $this->position = $position; $this->value = $value; $this->item = $item; if(!is_array($text)) $text = [(string)$text]; foreach($text as $t) $this->text[] = (string)$t; } /** * Returns the grid point text for an axis level */ public function getText($level = 0) { return isset($this->text[$level]) ? $this->text[$level] : ''; } /** * Returns true when the text is empty */ public function blank($level = 0) { return !isset($this->text[$level]) || $this->text[$level] == ''; } /** * Returns a value from the item, or NULL */ public function __get($field) { if($this->item === null) return null; if(isset($this->item->$field)) return $this->item->$field; if($this->item->axis_text_class) { $tc = new TextClass($this->item->axis_text_class, 'axis_text_'); return $tc->$field; } return null; } }