Reputation: 79
This is my inquiry (edited):
I try to plot a monthly graphic using Charts, but I face some difficulties to put the names of the months on the X axis. My default value is like in the next image: default value
And after using the most upvoted answer from here, I got this
So after investing some hours with futile results I'd like to ask you if you know how to get a plot similar to this one, please. So to summarize:
Thanks in advance. If you need some of my code, I can share it with you.
Kind regards.
Upvotes: 1
Views: 845
Reputation: 79
After playing around and with a better research, this is the answer to my questions:
//Give the value of the months to the x axis
barChart.xAxis.valueFormatter = IndexAxisValueFormatter(values:months)
barChart.xAxis.granularity = 1
//Position of the x axis, rotation of the labels on the x axis and show all the names of the months consecutively
barChart.xAxis.labelPosition = XAxis.LabelPosition.bottom
barChart.xAxis.labelRotationAngle = -90.0
barChart.xAxis.setLabelCount(counter, force: false)
Upvotes: 1