Add support for PieChart colorAxis options

Created on 3 July 2024, 10 months ago

This patch adds support for the colorAxis options for the Pie Charts chart type.

With this patch the colorAxis option can be used to set a custom range of colours for the Pie chart display. For example:

						const contents = new Drupal.Charts.Contents();
						if (drupalSettings.hasOwnProperty('charts') && drupalSettings.charts.highcharts.global_options) {
						  Highcharts.setOptions(drupalSettings.charts.highcharts.global_options);
						}
						once('charts-highchart', '.charts-highchart', context).forEach(function (element) {
						  const id = element.id;
						  let config = contents.getData(id);
						  config.legend.enabled = false;
						  delete config.colors;
						  config.colorAxis = {};
						  config.colorAxis.minColor = "#e3cccf";
						  config.colorAxis.maxColor = "#772310";
						  if (!config) {
						    return;
						  }

						  config.chart.renderTo = id;
						  new Highcharts.Chart(config);
						  if (element.nextElementSibling && element.nextElementSibling.hasAttribute('data-charts-debug-container')) {
						    element.nextElementSibling.querySelector('code').innerText = JSON.stringify(config, null, ' ');
						  }
						}); 

Which result will be like this(Color is different):

Feature request
Status

Active

Version

5.0

Component

Highcharts integration

Created by

🇮🇳India visway12

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024