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:

but sometimes it looks like this:

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:
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).
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.
disable :
// xAxis.spaceMin = 0.9f
// xAxis.spaceMax = 0.9f
Most helpful comment
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.