-
-
Notifications
You must be signed in to change notification settings - Fork 6k
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 gradient line drawing to LineChartRenderer #3142
Conversation
Excited to see this re-implemented for a recent version of Charts. Thank you, @jjatie 👍🏻
EDIT: I was missing I still can't get a nice gradient line. Let's say I want everything below 50 to be red, between 50 and 100 to be yellow and 100+ to be green. What values should I put it I tried this:
A few things I noticed:
|
|
||
// create a new path | ||
let to = Int(ceil(CGFloat(to - from) * phaseX + CGFloat(from))) | ||
for i in (from + 1)..<to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_xBounds.max
and _xBounds.min
can be zeros when there's only one data entry and this for
is crashing the app with Fatal error: Can't form Range with upperBound < lowerBound
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It needs if dataSet.entryCount > 1
somewhere.
@natacodes thanks! good to have you help reviewing and providing feedback. |
@natacodes Thanks for the feedback. To be honest, I blindly reimplemented the solution from #649. I just wanted to get the ball rolling again on what I thought was a good feature. I would like to have an API that is unambiguous as to what values to provide as you mentioned. I will hopefully have time in the next week or so to more closely evaluate and test the solution. In the meantime, I encourage you to PR any suggestions you have for the implementation into this branch. |
@jjatie I tried, but it's a little bit too complex for me at this time. |
@natacodes No problem. This will take a little time for us to get around to, but I hope you are able to continue provide feedback when we do. Thank you. |
I actually wanted to try this out in my new app after we take care of others. |
|
||
for _ in dataSet.colors | ||
{ | ||
cColor = dataSet.color(atIndex: 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jjatie just want to check that this line is correct. It iterates over dataSet.colors
, but always takes color at index 0
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for i in dataSet.colors.indices
{
cColor = dataSet.color(atIndex: i)
Added gradient line drawing to LineChartRenderer. based on PR #3142
I think this PR can be closed now, since PR #3415 is based on this one and it was just merged into branch 4.0.0. |
Hey guys, can this functionality be used in production now? |
Reimplemented #649 for modern Swift and Charts