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

Line chart fill color goes above/below zeroline #3377

Closed
1 task done
steve509 opened this issue Apr 2, 2018 · 2 comments
Closed
1 task done

Line chart fill color goes above/below zeroline #3377

steve509 opened this issue Apr 2, 2018 · 2 comments

Comments

@steve509
Copy link

steve509 commented Apr 2, 2018

What did you do?

I've set the fillColor property of an instance of LineChartDataSet.

What did you expect to happen?

I expected the line chart to fill with the specified color.

What happened instead?

The line chart fills with the specific color but it goes above/below the zero line.

See below:
fill-issue-caption

Charts Environment

Charts version/Branch/Commit Number: Charts, 3.0.5
Xcode version: Xcode 9.2
Swift version: Swift 4
Platform(s) running Charts: iOS
macOS version running Xcode: macOS High Seirra 10.13.3

Demo Project

@steve509
Copy link
Author

steve509 commented Apr 3, 2018

Found a solution to this:

class LineChartFillFormatter: IFillFormatter {
    func getFillLinePosition(dataSet: ILineChartDataSet, dataProvider: LineChartDataProvider) -> CGFloat {
        return 0
    }
}
dataSet.fillFormatter = LineChartFillFormatter()

@steve509 steve509 closed this as completed Apr 3, 2018
@lieudd
Copy link

lieudd commented Jun 15, 2021

This save my day when I try always to fill color below the line. Thank!

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

No branches or pull requests

2 participants