/** * 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); }
/** * 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; }
/** * 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); }