-
-
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
Date formatter doesn't show up properly when using multiple bars in a chart. #2030
Comments
You have 27 entries for each data set? What's the last entry x value? It seems like it's your setup problem. The label is not centered properly. Check out have you set group space, bar width properly. float groupSpace = 0.08f;
float barSpace = 0.03f;
float barWidth = 0.2f;
// (0.2 + 0.03) * 4 + 0.08 = 1.00 -> interval per "group" make sure the sum is 1.0 to test. |
Dear liuxuan30, thanks for assisting. Regarding your questions:
and in the data formatter::stringForValue that is taken into account:
//xMin is first value //totalItems is the number of data in each data set (27 in this case)
Any hint? Thanks again! |
Sorry, '4' should mean the count of data sets in ChartsDemo. What I meant is you can check ChartsDemo - multiple bar chart as example. I remember it's supposed to be 1.0, someone mentioned it in the past. I just saw your labels are not centered properly, so things might goes wrong. I notice your data is all displayed, however the x axis labels does not match. Can you check your formatter? e.g. When it formats to "15. Dec", what's the original value for it? Ideally, the last label should be in a small delta from BTW, if you just want to show single days, why not use [1,30] as your x values? |
Thank you so much liuxuan! The key was understanding that I didn't have to use '4' but '2' in the equation, meaning to understand that that was the number of data sets. Regarding to your other point/suggestion I cannot use [1,30] as x values because different graphs have different data ranges (like 3 months for example) and labels have to be adjusted accordingly. Thanks a lot again! |
@micmar what make it work then? correcting to the right data sets count? |
Exactly: as I said using '2' (I have two data sets) rather than '4' in the equation, made it work. |
ok, cool :) |
Premise: it was all working nicely before version 3, where NSFormatters are used for X axis.
I have a BarChartView where the X axis formatter is a DateValueFormatter (as nicely provided in demo code).
I am looking at demo code MultipleBarChartViewController.m, but unfortunately there years are integer, not date, which is where I get the problem.
In my case, the BarChartViewhas two different BarChartDataSet and at this point the dates in X axis are confused and they are only half of what they should be.
For example if it is supposed to go from 1st December to 31st December, it goes only from 1st to 15th of December, spread in the whole axis.
Hopefully the attachment helps to understand the problem.
(It is supposed to go from 1st to 31st).
Does anyone see this? Is this a bug or did I implement it wrongly?
Keep up the great work!
Mik
The text was updated successfully, but these errors were encountered: