-
-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
XAxis label issue with multiple/grouped bar chart #2481
Comments
I have solved this by changing group space count function. Earlier i was counting it as (groupSpace * barSpace) * n + groupSpace = 1 But this was wrong, i have change it to (bar width * barSpace) * n + groupSpace = 1 so my new function for n number of columns is
Hope this may help others.. |
My question is related to above one only.
Check this ScreenShot: Issues: Why all xaxis labels are not showing? And if showing, it is not in proper manner? I am using Swift 4 & Xcode 9.2UPDATE(08th of May - 2018): I have solved this issue, please check this link: https://github.com/sagarsukode/Charts |
@sagarsukode did you find any solution for the problem ? |
I had the same issue like the above, i fixed it by duplicating the months in an array so i guess in your case you will have something like: in the IndexAxisValueFormatter(values: your_array_here) use the xAxisLabels array; hope that helps! |
@atalayasa & @mazenhalawi : Hello, I have solved this issue, please check this link: https://github.com/sagarsukode/Charts |
@sagarsukode Thank you verify much sagarsukode. This really helps me to fix xaxis label issue. |
Thank you so much. |
@sagarsukode THANK YOU! |
Thanks!!!! |
I want to create multiple/grouped bar chart dynamically. In my case data comes from server, so number of bars are not fixed. To calculate group space, i have created this function
func calcGroupSpace(n:Int)->Double{ let y = 0.03 * Double(n) let x : Double = 1 / (y+1) return x }
My xValues are, which is also from server, here i have make array for better understanding.
let xVal = ["Apples", "Oranges", "Pears", "Grapes", "Bananas"]
I have created value formatter class.
`class BarChartFormatter: NSObject, IAxisValueFormatter {
}
`
And inside my chart, here is code for x-axis and group space
` let chartFormatter = BarChartFormatter(labels: xAxis)
The problem is, my x-axis labels are displayed in wrong order. It should be as given, but it prints something like this
Please help me to solve this.
The text was updated successfully, but these errors were encountered: