with the following code
barchart.xAxis.labelTextColor = UIColor.white
barchart.xAxis.labelPosition = .topInside
barChart.xAxis.setLabelCount(7, force: true)
Issue: x axis grid get destructed
barchart.xAxis.labelTextColor = UIColor.white
barchart.xAxis.labelPosition = .topInside
Issue: Right side Label gets hidden
Solution Required: Need Following to be fixed:
*Grid should be aligned
*Label should be viewed
my code is :
barChart.legend.enabled = false
barChart.xAxis.labelTextColor = UIColor.white
barChart.xAxis.labelPosition = .topInside
barChart.leftAxis.drawAxisLineEnabled = true
barChart.leftAxis.enabled = true
barChart.leftAxis.drawGridLinesEnabled = false
barChart.rightAxis.drawAxisLineEnabled = false
barChart.rightAxis.drawGridLinesEnabled = true
barChart.rightAxis.drawLabelsEnabled = true
barChart.rightAxis.labelFont = NSUIFont.systemFont(ofSize: 13.0)
barChart.xAxis.labelFont = NSUIFont.systemFont(ofSize: 16.0)
barChart.rightAxis.labelTextColor = UIColor.white
barChart.leftAxis.axisMinimum = 0.0
barChart.rightAxis.axisMinimum = 0.0
barChart.rightAxis.drawLabelsEnabled = false
var dataEntries: [ChartDataEntry] = []
for i in 0..<dataPoints.count {
let dataEntry = BarChartDataEntry(x: Double(i),yValues: [values[i]])
dataEntries.append(dataEntry)
}
let chartDataSet = BarChartDataSet(values: dataEntries, label: "HB2")
let chartData = BarChartData(dataSet: chartDataSet)
chartData.setValueFormatter(DefaultValueFormatter(formatter: formatter))
barChart.xAxis.valueFormatter = IndexAxisValueFormatter(values:dataPoints)
barChart.data = chartData