-
-
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
Bar chart floating y position #947
Comments
Not sure what you want to config. x axis is index based, so depends on how many bars you have, the x value position is calculated then. |
Always same number of items (bars). Only values is changing. sry. not x position but y. |
then update your data sets |
Thanks, but I think we're not on the same page here. I will create example project. :) |
maybe screenshots and explaination, demo project is too heavy |
Views: DataSet:
yVals and items always contains same number of items. |
I have the same problem. If I have 10 values along the xAxes, 9 of which are 0 (no bar) and the 10th value is say 20 (anything > 0) then the single bar floats about 10px above the x-axis. If on the other hand, I have 10 values along the xAxes, all of which are > 0 then they all sit right on the x-axis. You can see this in the image above. In the initial state, the bars are floating ~10 px above the x-axis. However, in the "After a while" graph you can see they're much closer to the x-axis. This happens when some of the bars have a 0 value. If you can point me to where in the code this might be happening, perhaps I can create a PR with a fix. |
could you just turn on displaying the y axis values, so we know the y axis range? Also, which version are you using? |
If I understand you correctly, your Y values range is changing. When the max value is getting bigger, the other bars are getting smaller relatively. |
@jleach seems your issue is different? I tried your 71 and 23 zeroes with ChartsDemo, it's fine. I think you got something wrong with your code, or you modified something. The typical work flow is first configure the chart properties, and then setup the data. Make sure chartView.data = yourData is the last line; or you call notifyDataSetChanged() everytime you changed something about axis ranges. |
@liuxuan30 I tried moving the chartView.data = to the be the last line and tried calling notifyDataSetChated() - no luck. Here is my method: I'll go back and see if I'm messing with the layout or something. The only thing I can think of is that I'm embedding the chart in a UIView. Maybe a constraint is causing me grief? |
@jleach constraints should impact the whole chart view, not just axis or a bar, right? unless you separate them..
the second chartView.notifyDataSetChanged() is not needed as data setter will call it once. I mean something like:
BTW, from your code, I see you only use rightAxis, but you don't assign data set axis dependency to right, and default is left axis. I also suspect your you can try |
You have not responded to my reply. Have you checked it out? |
Hello.
I'm using BarChartView with following configuration:
BarChartData is updated every second. After a while chart y position is changing. Smth. like +/- 8pt.
Is it configurable?
Thanks in advance.
The text was updated successfully, but these errors were encountered: