Charts: Line chart fill color goes above/below zeroline

Created on 2 Apr 2018  路  1Comment  路  Source: danielgindi/Charts

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

Most helpful comment

Found a solution to this:

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

>All comments

Found a solution to this:

class LineChartFillFormatter: IFillFormatter {
    func getFillLinePosition(dataSet: ILineChartDataSet, dataProvider: LineChartDataProvider) -> CGFloat {
        return 0
    }
}
dataSet.fillFormatter = LineChartFillFormatter()
Was this page helpful?
0 / 5 - 0 ratings

Related issues

newbiebie picture newbiebie  路  3Comments

BrandonShega picture BrandonShega  路  4Comments

cilasgimenez picture cilasgimenez  路  4Comments

JW00332 picture JW00332  路  4Comments

guanyanlin picture guanyanlin  路  3Comments