I'm using the fabulous iOS Charts library (https://github.com/danielgindi/ios-charts) and I'm having a hard time finding anything to support this behavior in the documentation. I'd like to force the y-axis to always display a range from 0-35. Currently, if I only have one data entry in at say (0, 9) the y-axis will display its range as 0-9. However when I add another entry at (1, 32) suddenly I can see the top of the graph at 35.
There are three methods that look promising (because they're related) but they aren't quite providing the type of behavior that I'm looking for.
Take a look at below properties. Should be able to solve your problem.
/// A custom minimum value for this axis. /// If set, this value will not be calculated automatically depending on the provided data. /// Use resetCustomAxisMin() to undo this. /// Do not forget to set startAtZeroEnabled = false if you use this method. /// Otherwise, the axis-minimum value will still be forced to 0. public var customAxisMin = Double.NaN /// Set a custom maximum value for this axis. /// If set, this value will not be calculated automatically depending on the provided data. /// Use resetCustomAxisMax() to undo this. public var customAxisMax = Double.NaN /// if true, the y-label entries will always start at zero public var startAtZeroEnabled = true
_chartView.leftAxis.customAxisMax = 35; _chartView.leftAxis.customAxisMin = 0;
_chartView.leftAxis.startAtZeroEnabled = YES;