question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Strange issue with chartjs-color

See original GitHub issue

Expected Behavior

Ideally, it would be great to fallback to a value, and catch this as an exception rather throw Error.

Current Behavior

Better handling of Error, when this error occurs, the chart disappears. Main issue with this bug is a string value to “center” is causing an error to be thrown.

Possible Solution

Add validation to if statement to match only valid Rgba values. chartjs-color/index.js (line 25-35)

if (typeof obj === 'string') {
    vals = string.getRgba(obj);
if (vals) {
    this.setValues('rgb', vals);
} else if (vals = string.getHsla(obj)) {
    this.setValues('hsl', vals);
} else if (vals = string.getHwb(obj)) {
    this.setValues('hwb', vals);
} else {
    throw new Error('Unable to parse color from string "' + obj + '"');
}

Steps to Reproduce (for bugs)

This bug is rather difficult to produce, occurs occasionally. screen shot 2017-03-03 at 8 16 58 am

Context

Environment

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Jareechangcommented, Mar 6, 2017

sorry, this is not 2.5.0 but master. I’ll give that a try and see if this issue still occurs.

0reactions
Jareechangcommented, Mar 11, 2017

sorry I didn’t follow up. The issue are there not there anymore after npm update. You can close this ticket.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Automatic colors assignment in chart.js 2.x doesn't work ...
All colors used in chart examples in the docs are defined explicitly. And this two-month-old issue features a categorical response from a Chart....
Read more >
Colors | Chart.js
No information is available for this page.
Read more >
Chart.js issue : r/Angular2 - Reddit
The chart is rendering correctly, however I am having an issue when trying to display the [colors] property of the chart.
Read more >
How to Change onHover Color of X-axis Labels in Chart JS
This will make the color of the x-axis change. Let's explore this right now! ▭ Chartjs Viewers Question Series ▭▭▭▭▭▭▭▭▭▭ This is ...
Read more >
Change Border Color and Add Annotation Line on Hover in ...
In Chart JS changing the border color on hover for a line chart is not possible by default. Luckily with some small adjustments...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found