Skip to content
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

added support for linear gradient on foreground to span the amount vi… #326

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

banjahman
Copy link

This fit what I needed perfectly, however I'm using with arc and offset and need a gradient to cover the foreground

@banjahman
Copy link
Author

@aterrien what needs done here to test and merge this? My implementation of this relies on these gradients.

var gwidth = perc === 100 ? this.w : (this.w * perc);
var grad = c.createLinearGradient(0, this.h, gwidth, this.h);
grad.addColorStop(0, this.o.fgGradientStart);
grad.addColorStop(1, this.o.fgGradientEnd);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that gwidth formula will be better like that (in case of negative this.o.min) :
var gwidth = (((this.cv - this.o.min) * this.w) / (this.o.max - this.o.min));

Using this.cv allows to change color dynamically.

The result is cool but why use gradients instead of changing the fgcolor of the entire circle while changing value ? with new props fgColorMin, fgColorMax for example ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants