Skip to content
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

BarChart not respecting bar width on redraw #4044

Open
francos opened this issue May 18, 2018 · 2 comments
Open

BarChart not respecting bar width on redraw #4044

francos opened this issue May 18, 2018 · 2 comments
Labels
bug confirmed bugs or otherwise incorrect behavior
Projects

Comments

@francos
Copy link

francos commented May 18, 2018

Summary
I'm using a BarChart in an app but sometimes when I re-draw it the bars width is not respected and I get inconsistent results (even though the amount of values in the X axis is always 100).

This is how I want it to look always:

screen shot 2018-05-18 at 6 56 32 pm

but sometimes it looks like this:

screen shot 2018-05-18 at 6 56 17 pm

Does anyone know why this happens and how can I force it to always look the same?

I'm already setting a bar width value like this but it doesn't help:

barChartView?.data?.barWidth = 0.3f

Expected Behavior
The bars in the chart have the same width every time.

Device:

  • Device: Moto X 2nd gen
  • Android Version: 6.0
  • Library Version: 3.0.3

Additional Context
I think the issue has something to do with the range of values in the X axis, as the chart looks good when the range goes from 0 to 50 or similar, but it looks bad when the range is smaller (e.g. from 0 to 15 or 0 to 24).

@almic
Copy link
Contributor

almic commented May 19, 2018

I will admit, I tried working with the bar width and gave up because it was too hard to make it look right. I've edited your issue and removed all the code, since the problem isn't really within your code, but with the confusing nature of the library on bar widths.

I think the width should be a basic DP value, with a spacing option either in DP as well or a percentage of the bar width. Right now you can only set the bar width in terms of "values" which is a fairly ambiguous term, and only allows you to go up to the distance between values before they start overlapping, not actual DP values, and it won't push the bars apart if you set the value to be larger than the label interval.

@almic almic added the bug confirmed bugs or otherwise incorrect behavior label May 19, 2018
@almic almic added this to To do in Support May 19, 2018
@nmorteza
Copy link

disable :
// xAxis.spaceMin = 0.9f
// xAxis.spaceMax = 0.9f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug confirmed bugs or otherwise incorrect behavior
Projects
Support
To do
Development

No branches or pull requests

3 participants