Skip to content
Snippets Groups Projects
Commit 890e5129 authored by Carlos Romero's avatar Carlos Romero Committed by Daniel Cothran
Browse files

Issue #3451038: Bad order in colors, if have more than 10

parent 85f87421
No related branches found
No related tags found
1 merge request!97if color is null, set white
Pipeline #208326 passed with warnings
......@@ -139,14 +139,11 @@
chart = new google.visualization.Table(document.getElementById(chartId));
}
// Fix for https://www.drupal.org/project/charts/issues/2950654.
// Would be interested in a different approach that allowed the default
// colors to be applied first, rather than unsetting.
let color_regex = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
if (options['colors'] && options['colors'].length > 10) {
for (const i in options) {
if (i === 'colors') {
delete options[i];
break;
for (const i in options['colors']) {
if (!color_regex.test(options['colors'][i])) {
options['colors'][i] = '#FFFFFF';
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment