Sami
Sami

Reputation: 67

simple xAxis granularity setting in iOS Charts framework

i have been experimenting with the charts framework and things seems to be running as expected except the behavior of the xAxis.granularity setting.

barChartView.xAxis.valueFormatter = IndexAxisValueFormatter(values: ["A","B","C","D","E","F","G","H","I","J","K","L"])
barChartView.xAxis.granularityEnabled = true
barChartView.xAxis.granularity = 1

when i set granularity to 2 or above, i get the expected behavior of xAxis label spread out by the value i specified. (the 3 images are for a granularity of 2,3,4)

granularity = 2

granularity = 3

granularity = 4

but when i set granularity = 1 expecting a label under every barchart, i get this

granularity = 1

what am i missing ? or is there another setting to force a label at every point ? thanks

Upvotes: 3

Views: 1342

Answers (1)

Lal Krishna
Lal Krishna

Reputation: 16180

Try setting

setLabelCount(12, force: true) // replace 12 with your data.count

Upvotes: 4

Related Questions