-
Notifications
You must be signed in to change notification settings - Fork 760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RGBA notation doesn't work for colouring pie chart #476
Comments
I forked your jsfiddle and have a solution here: https://jsfiddle.net/WilliamJohnsonJr/vLzmydgo/3/ angular-chart.js converts hex colors to objects that look like this:
However, if we look at angular-chart.js (not the minified file, because that would be a real pain to read), it is missing an appropriate getColor() function on line 239 of angular-chart.js to convert rgba colors into objects. As a result, rgba values submitted as "rgba(number, number, number, number)" are not converted into objects properly like the hex colors are. Because of this, the rest of the functions fail to run properly, and you get a weird chart. It's because getColors () on line 223 of angular-chart.js is submitting strings rather than objects to getChartData() on line 286 of angular-chart.js when you input rgba values. So, we might want to come up with a function for angular-chart.js that converts an "rgba(number, number, number, number)" string into a properly formatted object. Is this feature already in angular-chart.js, or am I missing something? |
Fix for RGB/RGBA Colors using new notation and documentation (fixes issue jtblin#476)
I'm still getting this error, and I'm using the updated The graph gets shown, but when I try to hover I get the I've tried defining the color using
but that didn't work either. my canvas directive:
and corresponding data in controller
|
Can you provide a full jsbin to repro please? |
When I mouse hover a point, I get an error:
This is related to this issue? |
Overview
Describe the issue. What is the issue and what did you expect?
Because of issue #373 I moved to the latest versions of Chart.js and Angular-chart.js:
Both downloaded via npm. Before moving, the rgba notation worked for customizing the colours of pie charts. After moving to the newer version of both dependencies, rgba colours are only working for line and bar charts (haven't tested others), pie and doughnut charts aren't taking values I provide here.
Step to reproduce
Reproduced in jsfiddle:
http://jsfiddle.net/TSTS123/zcLvjLnL/
I've included a few prewritten attempts to predefine the colour-set used by the pie chart. Only hex notation seems to work (see "$scope.colors").
$scope.oldColors is what worked before upgrading.
All the others are variations of my attempts to get this working in the latest version. Is anybody able to get this working? I like the transparency effect of charts using the alpha value in rgba.
Thanks!
Tiago
The text was updated successfully, but these errors were encountered: