我正在使用 iOS-charts 构建图表
我正在尝试将 float 转换为 int,但 iOS 图表只允许在数据条目中使用 float :
let result = ChartDataEntry(value: Float(month), xIndex: i)
有谁知道确保只使用整数的方法吗?
最佳答案
对于 Swift 3.0 和 Charts 3.0,您需要为轴启用和设置粒度。
例子:
barChart.leftAxis.granularityEnabled = true
barChart.leftAxis.granularity = 1.0
关于iOS-图表 float 到整数 YAxis,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31318858/