1

I am trying to display a bar chart using this library with months as the X-label. However, the x labels seem to be duplicating and "bleeding" to the next columns especially when I scroll. How do I fix this?

enter image description here

enter image description here

Code:

let xAxis = barChartView.xAxis
    xAxis.drawGridLinesEnabled = false
    xAxis.drawLabelsEnabled = true
    xAxis.drawAxisLineEnabled = false
    xAxis.labelPosition = .bottom
    xAxis.enabled = true
    xAxis.axisLineColor = white
    xAxis.labelTextColor = white
    xAxis.decimals = 0
    xAxis.granularity = 1
    xAxis.granularityEnabled = true

After grabbing data

    // indexCounter = # of data points
    xAxis.valueFormatter = IndexAxisValueFormatter(values: xAxisLabelValues)
    xAxis.setLabelCount(Int(indexCounter), force: true)
    notifyDataSetChanged()
Mocha
  • 2,035
  • 12
  • 29

1 Answers1

0

No idea how it works.. but removing the setLabelCount fixed the problem for me...

Mocha
  • 2,035
  • 12
  • 29