/**
  * Builds the configOptions object.
  *
  * Passing an array of key value pairs will set the configuration for each
  * child object created from this master object.
  *
  * @param array Array of options.
  * @return \configOptions
  */
 public function __construct($config)
 {
     $this->className = Helpers::get_real_class($this);
     if (is_array($config)) {
         foreach ($config as $option => $value) {
             if (in_array($option, $this->options)) {
                 $this->{$option}($value);
             } else {
                 $this->error('Ignoring "' . $option . '", not a valid configuration option.');
             }
         }
     } else {
         $this->type_error($this->className . '()', 'array', 'with valid keys as ' . Helpers::array_string($this->options));
     }
     return $this;
 }
예제 #2
0
 /**
  * An object that specifies the axis title text style.
  *
  * @param textStyle $titleTextStyle
  * @return \Axis
  */
 public function titleTextStyle($titleTextStyle)
 {
     if (Helpers::is_textStyle($titleTextStyle)) {
         $this->titleTextStyle = $titleTextStyle->values();
     } else {
         $this->type_error(__FUNCTION__, 'object', 'class textStyle');
     }
     return $this;
 }
예제 #3
0
 /**
  * An object with members to configure various vertical axis elements. To
  * specify properties of this property, create a new vAxis() object, set
  * the values then pass it to this function or to the constructor.
  *
  * @param vAxis $vAxis
  * @return \AreaChart
  */
 public function vAxis($vAxis)
 {
     if (Helpers::is_vAxis($vAxis)) {
         $this->addOption($vAxis->toArray());
     } else {
         $this->type_error(__FUNCTION__, 'vAxis');
     }
     return $this;
 }
예제 #4
0
 /**
  * Adds multiple rows to the DataTable.
  *
  * @see addRow()
  * @param array Multi-dimensional array of rows.
  * @return \DataTable
  */
 public function addRows($arrayOfRows)
 {
     if (Helpers::array_is_multi($arrayOfRows)) {
         foreach ($arrayOfRows as $row) {
             $this->addRow($row);
         }
     } else {
         $this->error('Invalid value for addRows, must be type (array), multi-dimensional.');
     }
     return $this;
 }
예제 #5
0
 /**
  * Overrides the global pieSliceTextSlice for this slice.
  *
  * @param textStyle Valid textStyle object.
  * @return \slice
  */
 public function textStyle($textStyle)
 {
     if (Helpers::is_textStyle($textStyle)) {
         $this->textStyle = $textStyle->values();
     } else {
         $this->type_error(__FUNCTION__, 'textStyle');
     }
     return $this;
 }
예제 #6
0
 /**
  * Sets The user interaction that causes the tooltip to be displayed.
  *
  * 'focus' - The tooltip will be displayed when the user hovers over an element.
  * 'none' - The tooltip will not be displayed.
  *
  * @param string Type of trigger, [ focus | none ].
  * @return \tooltip
  */
 public function trigger($trigger)
 {
     $values = array('focus', 'none');
     if (in_array($trigger, $values)) {
         $this->trigger = $trigger;
     } else {
         $this->type_error(__FUNCTION__, 'string', 'with a value of ' . Helpers::array_string($values));
     }
     return $this;
 }
예제 #7
0
 /**
  * Sets the height of the chart in the container.
  *
  * @param int Amount in pixels
  * @return \chartArea
  */
 public function height($height)
 {
     if (Helpers::is_int_or_percent($height)) {
         $this->height = $height;
     } else {
         $this->type_error(__FUNCTION__, 'int | string', 'representing pixels or a percent.');
     }
     return $this;
 }
예제 #8
0
 /**
  * An object with members to configure various tooltip elements. To specify
  * properties of this object, create a new tooltip() object, set the values
  * then pass it to this function or to the constructor.
  *
  * @param tooltip $tooltipObj
  * @return \Chart
  */
 public function tooltip($tooltipObj)
 {
     if (Helpers::is_tooltip($tooltipObj)) {
         $this->addOption($tooltipObj->toArray());
     } else {
         $this->error(__FUNCTION__, 'tooltip');
     }
     return $this;
 }
예제 #9
0
 /**
  * Sets the angle of the axis text, if it's drawn slanted. Ignored if
  * axis.slantedText is false, or is in auto mode, and the chart decided to
  * draw the text horizontally.
  *
  * This option is only supported for a discrete axis.
  *
  * @param int Angle of labels
  * @return \hAxis
  */
 public function slantedTextAngle($angle)
 {
     if (is_int($angle) && Helpers::between($angle, 1, 90)) {
         $this->slantedTextAngle = $angle;
     } else {
         $this->type_error(__FUNCTION__, 'int', 'between 1 - 90');
     }
     return $this;
 }