return false;
}
+function containsColorsDefinition(
+ descriptor: ColorsDescriptor
+) {
+ return descriptor && (descriptor.borderColor || descriptor.backgroundColor);
+}
+
export default {
id: 'colors',
}
const {
- options: {elements},
- data: {datasets}
+ data: {datasets},
+ options: chartOptions
} = chart.config;
+ const {elements} = chartOptions;
- if (!options.forceOverride && (containsColorsDefinitions(datasets) || elements && containsColorsDefinitions(elements))) {
+ if (!options.forceOverride && (containsColorsDefinitions(datasets) || containsColorsDefinition(chartOptions) || (elements && containsColorsDefinitions(elements)))) {
return;
}
--- /dev/null
+module.exports = {
+ config: {
+ type: 'bar',
+ data: {
+ labels: [0, 1, 2, 3, 4, 5],
+ datasets: [
+ {
+ data: [0, 5, 10, null, -10, -5],
+ },
+ {
+ data: [10, 2, 3, null, 10, 5]
+ }
+ ]
+ },
+ options: {
+ backgroundColor: ['red', 'green'],
+ scales: {
+ x: {
+ ticks: {
+ display: false,
+ }
+ },
+ y: {
+ ticks: {
+ display: false,
+ }
+ }
+ },
+ plugins: {
+ legend: false,
+ colors: {
+ enabled: true
+ }
+ }
+ }
+ }
+};