Skip to content

Barchart: Error unable to parse color from object #10

Description

@toonevdb

Hello,

I'm getting the following error when using patternomaly as the backgroundColor when using a barchart:

Uncaught Error: Unable to parse color from object {"shapeType":"dot"}
    at Color (vendor-bundle.js:52739)
    at Color (vendor-bundle.js:52699)
    at Object.helpers.color (vendor-bundle.js:58367)
    at mergeOpacity (vendor-bundle.js:61267)
    at vendor-bundle.js:61935
    at Object.helpers.each (vendor-bundle.js:57465)
    at vendor-bundle.js:61923
    at Object.helpers.each (vendor-bundle.js:57465)
    at ChartElement.drawBody (vendor-bundle.js:61920)
    at ChartElement.draw (vendor-bundle.js:62012)
    at Chart.Controller.draw (vendor-bundle.js:56740)
    at ChartElement.animation.render (vendor-bundle.js:56699)
    at Object.startDigest (vendor-bundle.js:56121)
    at vendor-bundle.js:56094

The error comes from the following code in the Chart.js library in /dist/Chart.js around line 280:

else if (typeof obj === 'object') {
	vals = obj;
	if (vals.r !== undefined || vals.red !== undefined) {
		this.setValues('rgb', vals);
	} else if (vals.l !== undefined || vals.lightness !== undefined) {
		this.setValues('hsl', vals);
	} else if (vals.v !== undefined || vals.value !== undefined) {
		this.setValues('hsv', vals);
	} else if (vals.w !== undefined || vals.whiteness !== undefined) {
		this.setValues('hwb', vals);
	} else if (vals.c !== undefined || vals.cyan !== undefined) {
		this.setValues('cmyk', vals);
	} else {
		throw new Error('Unable to parse color from object ' + JSON.stringify(obj));
	}
}

obj only has the shapeType property. Is this fixable? The error occurs when hovering over the chart.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions