-
-
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
Grouped bar chart plotting wrong !! #3457
Comments
… index. This will avoid setting x offset on a wrong data entry
@liuxuan30 both reference issues are related to alignment, whereas here its about plotting the data set on wrong x. i.e if you look at the data3(light green bar) it supposed to plot on position on 3 in X-Axis(Ref Figure 1), instead its wrongly plotting on 0 in X-Axis (Ref Figure 2). Am I missing something? |
there are some few things I am confused: but you instead ignored to feed the value, and causing data from 4 bars (json) to 3 bars like, (though not feeding 0 for null should work as well, as below works when you have different size of each data set)
which seems weird to me; and you haven't posted your code how you group bars; it's like you have indeed grouped them, every x has 3 bars; the X0 looks correct, as it's using [48.76, 50, 10] as the bars, which are the first value of each data set, and same rules apply to your X1, X2. so at X1, you got [null, 23.43, 23.43] and X3 [null, 33.76, 43.76] and have you looked at ChartsDemo multiple bar chart? especially You missed the comment:
so your X value in your data set is actually overwritten. Is this your problem? You have to follow how it works and reorg your data sets to get what you want. |
You can download the demo project from the google drive link mentioned in the "Demo Project" in the actual post
Yes, I guess thats my problem. Could you please have a look on https://github.com/danielgindi/Charts/pull/3459 |
What did you do?
I was trying to plot a grouped bar chart for following data
After converting the JSON to BarChartDataSet, the data set looks like as follows:
What did you expect to happen?
I am expecting a graph as follows:
What happened instead?
The graph is plotting on wrong x point.
The
data3
have value forx3
, but its plotting onx0
The
data2
supposed to start fromx1
, but its rendered onx0
position.i.e if we have multiple data set and few data set does not have y value for the initial x position compare to other data set in the group, then the bars are rendered in wrong position.
Please find the screenshot below:
Charts Environment
Charts version/Branch/Commit Number: 3.1.1
Xcode version: 9.3 (9E145)
Swift version: 4.0
Platform(s) running Charts: iOS
macOS version running Xcode: 10.13.4 (17E202)
Demo Project
I have upload the sample project to google drive to demonstrate the issue
You can download the project from here: https://drive.google.com/open?id=122fRz972mfBsladaSqPVHIyMLxYczTPd
The text was updated successfully, but these errors were encountered: