Maybe it's not the best title, but here is the explanation with images:
Sorry for the bad mock, but you get the idea.
All the values that are negative, the "bars" that are starting from 0 downwards, I want them to start from the bottom upwards.
Upon reading the docs I think I have to set the leftAxis.axisMinValue
, but it doesn't affect the chart in any way.
// create dataSet (LineChartDataSet)
leftAxis.axisMinValue = dataSet.yMin
// create LineChartData and set to chart's data property
Maybe I'm missing something, it's not the right thing to set, or it's a bug. I did a bit of debugging and found that the axisMinValue
is initially 0, and it gets set correctly to the passed value.
Okay, I figured it out:
You need to set a custom FillFormatter
on the dataSet (dataSet.fillFormatter
)
class FillFormatter: ChartFillFormatter {
func getFillLinePosition(dataSet dataSet: ILineChartDataSet, dataProvider: LineChartDataProvider) -> CGFloat {
return CGFloat(dataProvider.getAxis(.Left).axisMinValue)
}
}