-
-
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
offset goes wrong when using mutiple bar chart in combined chart #1813
Comments
I don't see this happens in ChartsDemo. Would you check ChartsDemo - combined chart and turn on |
My code is : let xAxis : XAxis = combinedChart.xAxis
Now what I found is, When I set granularity = 0.0, The app is working fine but with repeating values. But when I changed granularity = 1.0 and combinedChart.xAxis.axisMinimum = 0.0 combinedChart.xAxis.axisMaximum = 11 + 0.45, The app is crashing with fatal error: Index out of range Not getting what is the issue. |
don't mix up different issues in one thread. For the issue in this thread, it's about how you define the granularity, and how you format your axis labels to avoid duplicated 'Oct'. The alignment issue I don't see in ChartsDemo, so I would guess you should put chartView.data = chartData at last, or call The crash issue, please paste the log where it crashes not just a wild 'index out of range'. Also, do check |
I am having the same issue. From what I saw inside
After this:
This causes
In the Someone has any suggestions ? |
Just want to share my experience, I solved this issue using a dynamic granularity, make chart adjust while zooming Important do not force labelCount First I have many datasets, so I group datasets values using
Adjust granularity base on how many columns you want to see Then set data Then I use a custom Formatter to calculate label to be shown
Set the custom formatter
Try and let me know. Happy coding! |
Hey @samueleperricone, thanks for your help, but don't post same code for different issues, they may not be related. |
the mutiple bar chart xAxis offset goes wrong i have the same problem. @liuxuan30 i need your help .
the xValus's value are like
|
It has been sometime.. I don't recall. but if it's about grouped bars, before calling groupBars, make sure (baSpace + barWidth) * dataSet count + groupSpace = 1.0. Can you try? |
I just changed the (baSpace + barWidth) * dataSet count + groupSpace = 1.0 rules to make sure they are summed to 1. It seems to be a bit normal, but the first xAxisLabel is not displayed, then the xAxisLabel is shifted a bit to the right. the first xAxisLabel is not displayed . in other word , i want to the xAxisLabel for the firstIndex begin. Do you have some ideas ? |
this another issue : |
I see. there are two issues:
Usually, please don't ask irrelevant question in one thread. for 1, you have to take a look at for 2, it looks to me you didn't use |
thx your help me very much . now , it's only one last issue : |
I don't know what it is. And you should stop asking here.. |
@codingspark : Thank you so much for your answer on this issue. Your code works like charm. Neat, clean & clear answer. Really appreciated. |
I've used a CombinedChartView which has chartdata & linedata. The chartdata is grouped but the xAxis labels are not in sync with bars.
Here is the same issue which is already closed : #1566
I have used @sree127 solutions but it is not working with me. The labels are repeating and they are not matches with bars.
Can anybody help me?
Thanks.
The text was updated successfully, but these errors were encountered: