/** * 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); }
/** * Builds the MagnifyingGlass object. * * @param array $config * @return \Khill\Lavacharts\Configs\MagnifyingGlass * @throws \Khill\Lavacharts\Exceptions\InvalidConfigValue * @throws \Khill\Lavacharts\Exceptions\InvalidConfigProperty */ public function __construct($config = []) { $options = new Options($this->defaults); if (is_array($config) === true && count($config) == 0) { $config = ['enable' => true, 'zoomFactor' => 5]; } parent::__construct($options, $config); }
/** * Builds a new Filter Object * Takes either a column label or a column index to filter. The options object will be * created internally, so no need to set defaults. The child filter objects will set them. * * @param \Khill\Lavacharts\Options $options * @param array $columnLabelOrIndex * @param array $config Array of options to set. * @throws \Khill\Lavacharts\Exceptions\InvalidConfigValue */ public function __construct(Options $options, $columnLabelOrIndex, $config = []) { if (is_array($config) === false) { throw new InvalidConfigValue(static::TYPE . '->' . __FUNCTION__, 'array'); } if (Utils::nonEmptyString($columnLabelOrIndex) === false && is_int($columnLabelOrIndex) === false) { throw new InvalidConfigValue(static::TYPE . '->' . __FUNCTION__, 'string|int'); } if (is_string($columnLabelOrIndex) === true) { $config = array_merge($config, ['filterColumnLabel' => $columnLabelOrIndex]); } if (is_int($columnLabelOrIndex) === true) { $config = array_merge($config, ['filterColumnIndex' => $columnLabelOrIndex]); } parent::__construct($options, $config); }
/** * Builds the ChartArea object when passed an array of configuration options. * * @param array $config * @return \Khill\Lavacharts\Configs\ChartArea * @throws \Khill\Lavacharts\Exceptions\InvalidConfigValue * @throws \Khill\Lavacharts\Exceptions\InvalidConfigProperty */ public function __construct($config = []) { $options = new Options($this->defaults); parent::__construct($options, $config); }
/** * Builds the Options object. * Passing an array of key value pairs will set the configuration for each * child object created from this parent object. * * @param \Khill\Lavacharts\Options $options * @param array $config Array of options. * @throws \Khill\Lavacharts\Exceptions\InvalidConfigValue */ public function __construct(Options $options, $config) { parent::__construct($options, $config); }