-
-
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
Line Chart ignores colors if mode is set to bezier. #4148
Comments
I'm having this same problem!! Has anyone figured out how to subclass and solve it?? To be clear, I'm focused on the LINE color (not the values or valLabel color). See example chart at SO: I'd be happy to fix and submit a PR if someone can coach me a bit. |
yes, I can subclass LineChartRenderer and implement my own drawHorizontalBezier() function |
I‘m not sure if this is a bug. // get the color that is specified for this position from the DataSet
let drawingColor = dataSet.colors.first! the bezier line are using the first color of each data set, so it should be working. Can you check what color are you setting? IMO if you set each data set a color, it should be fine. |
I guess my issue was not clear ... I have ONE line (from one data-set) but I want it drawn in TWO colors.... green above zero, and red BELOW zero ... but I've got it working via my subclass. Thanks for your response!! |
ok. FYI the linear lines supports colors per line segments. but for bezier, I think you are right that you need to override it to customize it. |
dgaedcke, can you share your code of how you managed to get it working via your subclass? |
Here is my subclass: `import Foundation let tsGreen = UIColor(red: 64/255, green: 196/255, blue: 152/255, alpha: 1) class ColoredLineChartRenderer: LineChartRenderer {
// var fillColor: UIColor { return strokeColor.withAlphaComponent(0.2) }
// print("y: (cur.y) when x is (cur.x)")
}` |
What did you do?
Attempt to draw a line chart with a bezier curve with different colors.
What did you expect to happen?
A line chart with different colors.
What happened instead?
A line chart with the first color.
Charts Environment
Charts version: 3.3.0
Xcode version: 10.3
Swift version:
Platform(s) running Charts:
macOS version running Xcode: 10.14.6
Demo Project
Using ChartsDemo-iOS-Swift
add the line
set.mode = .horizontalBezier // or the other bezier
after (line 87) in function setDataCount
set.setCircleColor(color)
in MultipleLinesChartViewController.swift
The text was updated successfully, but these errors were encountered: