If you have a bar chart with a missing column in the xaxis the groupBars function doesn't respect that data is missing for that axis value. For example if you have an x axis of 0, 1, 2, 3, 4 and 2 has no bar because the data is missing or there is nothing for that axis value. Calling group bars will result in the bars being drawn at 0, 1, 2, 3 and four will be left empty instead.
I suggest to check ur data before and set 0 to the missing data, So even if 2 has no data, it will be 0 as a value
Unfortunately that doesn't work for me, because empty and 0 have different meanings. In my chart a missing bar means data wasn't recorded, where as 0 is a possible valid value.
@bbrosius okey I see what u mean.
try this, it will fix the issue
chart.setFitBars(true);
Have a look on #BarChart in this link
https://github.com/PhilJay/MPAndroidChart/wiki/Setting-Data
Unfortunately that doesn't work the problem is the groupBars method in BarData loops through the data by index. I think for it to work with missing data it needs to loop through the data by x value, and skip missing x values.
In case someone needs the solution, you can try my solution to see if it fits your needs:
https://gist.github.com/yaroslav-shlapak/04586bade288dbac35c347643d86bf19
Most helpful comment
Unfortunately that doesn't work the problem is the groupBars method in BarData loops through the data by index. I think for it to work with missing data it needs to loop through the data by x value, and skip missing x values.