X-axis values on grouped bar chart

312 Views Asked by At

I have created group bar using iOS Charts library but unable to set X-axis values properly in swift3. So please help.

I add data like this

for i in 0 < data.count {
    let dataEntryForHours1 = BarChartDataEntry(x: Double(i), y: Double(value))
    let dataEntryForHours2 = BarChartDataEntry(x: Double(i), y: Double(value))
}

but still getting random double values on X-Axis like -0.5,0.3, 0.6 and so on.

1

There are 1 best solutions below

2
On

You need to assign an interval from 0 to data.count.

for i in 0..<data.count {
   // ...
}