/**
  * An array of slice objects, each describing the format of the
  * corresponding slice in the pie. To use default values for a slice,
  * specify a NULL. If a slice or a value is not specified, the global
  * value will be used.
  *
  * The values of the array keys will correspond to each numbered piece
  * of the pie, starting from 0. You can skip slices by assigning the
  * keys of the array as (int)s.
  *
  * This would apply slice values to the first and fourth slice of the pie
  * Example: array(
  *              0 => new slice(),
  *              3 => new slice()
  *          );
  *
  *
  * @param array Array of slice objects
  * @return \PieChart
  */
 public function slices($slices)
 {
     if (is_array($slices) && array_values_check($slices, 'class', 'slice')) {
         $pizzaBox = array();
         foreach ($slices as $key => $slice) {
             $pizzaBox[$key] = $slice->values();
         }
         $this->addOption(array('slices' => $pizzaBox));
     } else {
         $this->type_error(__FUNCTION__, 'array', 'with keys as (int) and values as (slice)');
     }
     return $this;
 }
Example #2
0
 /**
  * Colors to assign to values in the visualization. An array of strings,
  * where each element is an HTML color string.
  *
  * For example: $this->colors = array('red', '#004411')
  * You must have at least two values; the gradient will include all your
  * values, plus calculated intermediary values, with the first color as the
  * smallest value, and the last color as the highest.
  *
  * @param array colors
  * @return \colorAxis
  */
 public function colors($colors)
 {
     if (is_array($colors) && array_values_check($colors, 'string')) {
         $this->colors = $colors;
     } else {
         $this->type_error(__FUNCTION__, 'array', 'with values as strings');
     }
     return $this;
 }