MPAndroidChart icon indicating copy to clipboard operation
MPAndroidChart copied to clipboard

Bar chart spacing between bars - v3.0.0-beta

Open fabiorbap opened this issue 10 years ago • 6 comments

I want to set the spacing between bar charts. After some research, I found in this issue https://github.com/PhilJay/MPAndroidChart/issues/197 a method from BarDataSet:

barDataSet.setBarSpacePercent(...);

That works in version 2.2.5. However, I can't find any method related to that in version 3.0.0-beta.

How can I do that?

Thanks!

fabiorbap avatar Sep 16 '16 19:09 fabiorbap

barData.setBarWidth(0.5f)(half of the original width)

samueldweber avatar Sep 19 '16 19:09 samueldweber

You can control the bar width by calling barData.setBarWidth(...). Concerning the space between bars, that can be controlled by the position on the x-axis you place your bars.

PhilJay avatar Sep 19 '16 19:09 PhilJay

Concerning the space between bars, that can be controlled by the position on the x-axis you place your bars. Please be brief about it? Any code sample to prove?

econBabar avatar Dec 20 '17 07:12 econBabar

@econBabar I ended up using: mChart.getXAxis().setSpaceMax(5f);

MalcolmMcFly avatar Dec 21 '17 03:12 MalcolmMcFly

use barData.setBarWidth(1f); // without space between columns if you want set space, try decrease (0.9f, 0.8f...)

tsetserskaya avatar Dec 21 '17 09:12 tsetserskaya

use barData.setBarWidth(1f); It is working for me.

newcici7777 avatar May 17 '18 05:05 newcici7777