I am using this lib chart : https://github.com/danielgindi/Charts
I have one line chart. Which will display values on x axis. But now it's showing in decimal like 22.0
. But i want like 22
Here is my code :
func updateGraphMaster(xAxisLabel: String) {
var lineChartEntry = [ChartDataEntry]()
for num in 0..<chartDataDoubles.count {
let value = ChartDataEntry(x: Double(num), y: chartDataDoubles[num])
lineChartEntry.append(value)
}
let lineChartDataSet = LineChartDataSet(entries: lineChartEntry, label: xAxisLabel)
lineChartDataSet.colors = [NSUIColor.white]
lineChartDataSet.highlightEnabled = true
lineChartDataSet.highlightColor = UIColor.white
lineChartDataSet.drawVerticalHighlightIndicatorEnabled = false
lineChartDataSet.drawHorizontalHighlightIndicatorEnabled = false
lineChartDataSet.drawValuesEnabled = true
lineChartDataSet.drawCirclesEnabled = false
lineChartDataSet.drawCircleHoleEnabled = false
let gradient = getGradientFilling()
lineChartDataSet.fill = Fill.fillWithLinearGradient(gradient, angle: 90.0)
lineChartDataSet.drawFilledEnabled = true
let data = LineChartData()
data.addDataSet(lineChartDataSet)
data.setDrawValues(false)
data.setValueTextColor(NSUIColor.white)
let formatter = NumberFormatter()
formatter.maximumFractionDigits = 0
formatter.numberStyle = .none
formatter.locale = .current
//lineChartDataSet.valueFormatter = DefaultValueFormatter(formatter: formatter)
data.setValueFormatter(DefaultValueFormatter(formatter: formatter))
chartView.data = data
chartView.xAxis.valueFormatter = DefaultAxisValueFormatter(formatter: formatter)
}
Here i using setValueFormatter and append the data to chart view. But still it's showing in decimal . Not in integer.