iOS-Charts Float to Integer YAxis
问题 I'm building a chart using iOS-charts I'm trying to convert the floats into int, but iOS-charts only allows for Floats in the data entry: let result = ChartDataEntry(value: Float(month), xIndex: i) Does anyone know the method for making sure only ints are used? 回答1: You just need to adjust the NSNumberFormatter ... Example: yAxis.valueFormatter = NSNumberFormatter() yAxis.valueFormatter.minimumFractionDigits = 0 NSNumberFormatter is a very powerful class, you can do much much more with it. :-