protected function Highcharts::buildChartType in Charts 8.3
Build the chart type.
Parameters
array $options: Options.
Return value
\Drupal\charts_highcharts\Settings\Highcharts\Chart
1 call to Highcharts::buildChartType()
- Highcharts::buildVariables in modules/
charts_highcharts/ src/ Plugin/ chart/ Highcharts.php - Creates a JSON Object formatted for Highcharts JavaScript to use.
File
- modules/
charts_highcharts/ src/ Plugin/ chart/ Highcharts.php, line 475
Class
- Highcharts
- Defines a concrete class for a Highcharts.
Namespace
Drupal\charts_highcharts\Plugin\chartCode
protected function buildChartType(array $options) {
$chart = new Chart();
$chart
->setType($options['type']);
// Set chart width.
if (isset($options['width'])) {
$chart
->setWidth($options['width']);
}
// Set chart height.
if (isset($options['height'])) {
$chart
->setHeight($options['height']);
}
// Set background color.
if (isset($options['background'])) {
$chart
->setBackgroundColor($options['background']);
}
// Set polar plotting.
if (isset($options['polar'])) {
$chart
->setPolar($options['polar']);
}
if (!empty($options['three_dimensional'])) {
$threeDimensionOptions = new ThreeDimensionalOptions();
$chart
->setOptions3D($threeDimensionOptions);
$threeDimensionOptions
->setAlpha(55);
$threeDimensionOptions
->setViewDistance(0);
$threeDimensionOptions
->setBeta(0);
if ($options['type'] != 'pie') {
$threeDimensionOptions
->setAlpha(15);
$threeDimensionOptions
->setViewDistance(25);
}
}
return $chart;
}