-
-
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
Add gradient bars for BarChart [master branch] #4411
base: master
Are you sure you want to change the base?
Conversation
78706eb
to
842b0d8
Compare
if let set = chartView.data?.dataSets.first as? BarChartDataSet { | ||
set1 = set | ||
set1.replaceEntries(yVals) | ||
setup(set) |
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.
let's rename to a more meaningful name to imply it's about setup gradient
@@ -174,6 +175,11 @@ class LineChart1ViewController: DemoBaseViewController { | |||
set.mode = (set.mode == .cubicBezier) ? .horizontalBezier : .cubicBezier | |||
} | |||
chartView.setNeedsDisplay() | |||
case .toggleGradient: |
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.
is it possible for you to add the objc portion? (feel free to say no)
if dataSet.drawBarGradientEnabled { | ||
drawGradientBars(context: context, dataSet: dataSet, buffer: buffer, matrix: valueToPixelMatrix) | ||
} else { | ||
drawDefaultBars(context: context, dataSet: dataSet, dateSetIndex: index, buffer: buffer) |
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.
maybe drawNormalBars or standard bars, etc? not sure which is better. @jjatie idea?
context.setLineWidth(dataSet.barBorderWidth) | ||
context.stroke(barRect) | ||
} | ||
} |
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.
in gradient bars, accessibilityOrderedElements
is missing?
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.
@liuxuan30 pushed commit. Hope that I did it correct.
@@ -124,6 +140,26 @@ public class NSUIDisplayLink | |||
} | |||
} | |||
|
|||
extension NSUIColor | |||
{ | |||
var nsuirgba: (red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat)? { |
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.
though the imp is different, here are two var nsuirgba
in one extension? typo? or two vars indeed?
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.
@larryonoff can you get the notification? I basically finished the review, jsut some minor issues to address.
@@ -14,6 +14,22 @@ public typealias NSUIScrollView = UIScrollView | |||
public typealias NSUIScreen = UIScreen | |||
public typealias NSUIDisplayLink = CADisplayLink | |||
|
|||
extension NSUIColor | |||
{ | |||
var nsuirgba: (red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat)? { |
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.
move { to a new line
@jjatie @danielgindi please also take a look. Generally I'm accepting except for some minor issues. |
Hi i want to implement gradient bars with round corners when to expect this merge? |
@liuxuan30 @danielgindi Hi. Sorry for the delay in responding. Really busy these weeks. I won't be able to check this PR for some time. But I think It can be done without my help easily. |
@larryonoff I could fix most of them, but two left need your input, 1st is about 2st is about the var nsuirgba, I need your input which is new, because you added two same var with different implementation. And I can't tell which is the right one. |
rename `setup(_ dataSet: BarChartDataSet)` to `setupBarGradient(_ dataSet: BarChartDataSet)`
rename `drawDefaultBars` to `drawNormalBars`
just pushed commit
|
@larryonoff I saw nsuirgba is ported from 4.0 branch. I was evaluating which branch is better to merge, merging into master will have more conflicts while merging 4.0 branch, so I was kind of unsure. anyway, I could take on from here. Thanks! |
I think the best way is to merge 4.0 branch first, and try to merge this. I'm actively working on the 4.0 merge right now, and it could take 1-2 weeks to resolve the conflicts. |
@liuxuan30 Can we have a merged file in next few weeks? |
I think so, @larryonoff so we have merged the 4.0 branch into master, now this is the next we want to merge. I'm switching to master base |
@larryonoff any chance you could fix the conflicts? |
@liuxuan30 hey! sorry, but not in a week. very busy. |
@larryonoff @liuxuan30 Any chance to update in this week? |
Sorry I‘m super busy recently as well. I hope someone could help on this PR, basically solve the conflict with master. |
This would be easy to accomplish by providing your custom renderer, if #4297 was merged. |
Hi everyone! Sorry for hijacking this PR. But I';ve been reading the commits, and I still have no idea how to apply gradient colors to my EDIT: I suppose this hasn't been merged to the Master. |
May 2023 and still waiting on this... |
This PR adds functionality to draw gradient bars with BarChartDataSet based on
master
branch