Beispiel #1
0
 /**
  * Builds a new chart with the given label and DataTable.
  *
  * @param  \Khill\Lavacharts\Values\Label $chartLabel Identifying label for the chart.
  * @param  \Khill\Lavacharts\DataTables\DataTable $datatable DataTable used for the chart.
  * @param  array $config Array of options to set for the chart.
  * @return \Khill\Lavacharts\Charts\DonutChart
  */
 public function __construct(Label $chartLabel, DataTable $datatable, $config = [])
 {
     $options = new Options($this->donutDefaults);
     $options->set('pieHole', 0.5);
     parent::__construct($chartLabel, $datatable, $config);
     $this->options->merge($options);
 }
 /**
  * Builds a new chart with the given label.
  *
  * @param  \Khill\Lavacharts\Values\Label         $chartLabel Identifying label for the chart.
  * @param  \Khill\Lavacharts\DataTables\DataTable $datatable DataTable used for the chart.
  * @param  \Khill\Lavacharts\Options              $options Options fot the chart.
  * @param  array                                  $config Array of options to set on the chart.
  * @throws \Khill\Lavacharts\Exceptions\InvalidConfigValue
  */
 public function __construct(Label $chartLabel, DataTable $datatable, Options $options, $config = [])
 {
     $this->label = $chartLabel;
     $this->datatable = $datatable;
     $options->extend($this->chartDefaults);
     parent::__construct($options, $config);
 }
Beispiel #3
0
 /**
  * Creates a new ChartRangeUI object
  *
  * @param  array $config
  * @throws \Khill\Lavacharts\Exceptions\InvalidConfigValue
  */
 public function __construct($config = [])
 {
     $options = new Options($this->defaults);
     $options->extend($this->chartRangeDefaults);
     $options->remove(['label', 'labelSeparator', 'labelStacking', 'cssClass']);
     parent::__construct($options, $config);
 }
 /**
  * Builds a new chart with the given label.
  *
  * @param  \Khill\Lavacharts\Values\Label         $chartLabel Identifying label for the chart.
  * @param  \Khill\Lavacharts\DataTables\DataTable $datatable  DataTable used for the chart.
  * @param array                                   $config
  * @throws \Khill\Lavacharts\Exceptions\InvalidOption
  * @internal param array $options Array of options to set for the chart.
  */
 public function __construct(Label $chartLabel, DataTable $datatable, $config = [])
 {
     $calendarOptions = new Options($this->calendarDefaults);
     $options = new Options($this->extChartDefaults);
     $options->merge($calendarOptions);
     $options->set('calendar', $calendarOptions);
     parent::__construct($chartLabel, $datatable, $options, $config);
 }
 /**
  * Builds a new PieChart with the given label, datatable and options.
  *
  * @param  \Khill\Lavacharts\Values\Label         $chartLabel Identifying label for the chart.
  * @param  \Khill\Lavacharts\DataTables\DataTable $datatable DataTable used for the chart.
  * @param array                                   $config
  */
 public function __construct(Label $chartLabel, DataTable $datatable, $config = [])
 {
     $options = new Options($this->pieDefaults);
     if (isset($this->donutDefaults)) {
         $options->extend($this->donutDefaults);
         $options->set('pieHole', 0.5);
     }
     parent::__construct($chartLabel, $datatable, $options, $config);
 }
Beispiel #6
0
 /**
  * Sets the value of an boolean option.
  *
  * @param  string $option Option to set.
  * @param  bool   $value Value of the option.
  * @return \Khill\Lavacharts\JsonConfig
  * @throws \Khill\Lavacharts\Exceptions\InvalidConfigValue
  * @throws \Khill\Lavacharts\Exceptions\InvalidOption
  */
 protected function setBoolOption($option, $value)
 {
     if (is_bool($value) === false) {
         throw new InvalidConfigValue(static::TYPE . '->' . $option, 'bool');
     }
     $this->options->set($option, $value);
     return $this;
 }
Beispiel #7
0
 /**
  * Merges two Options objects and combines the options and values.
  *
  * @access public
  * @param  \Khill\Lavacharts\Options $options
  * @return \Khill\Lavacharts\Options
  * @throws \Khill\Lavacharts\Exceptions\InvalidConfigValue
  */
 public function merge(Options $options)
 {
     $this->extend($options->getDefaults());
     return $this->setOptions($options->getValues());
 }
 /**
  * Creates the new Filter object to filter the given column label or index.
  *
  * @param  string|int $columnLabelOrIndex The column label or index to filter.
  * @param  array $config Array of options to set.
  * @throws \Khill\Lavacharts\Exceptions\InvalidConfigProperty
  * @throws \Khill\Lavacharts\Exceptions\InvalidConfigValue
  */
 public function __construct($columnLabelOrIndex, $config = [])
 {
     $options = new Options($this->defaults);
     $options->extend($this->extDefaults);
     parent::__construct($options, $columnLabelOrIndex, $config);
 }
Beispiel #9
0
 /**
  * Builds a new Date or Number RangeUI object.
  *
  * @param array $config Array of options to set
  * @throws \Khill\Lavacharts\Exceptions\InvalidConfigValue
  */
 public function __construct($config = [])
 {
     $options = new Options($this->defaults);
     $options->extend($this->dataRangeDefaults);
     parent::__construct($options, $config);
 }