Rakesh Rakesh - 2 months ago 72x
Android Question

How to modify the bar width in MPAndroidChart BarChart?

I am using MPAndroidChart library.

I would like modify the size of bar present in bar chart. Could you let us know where to check for modify size of bar in bar chart in mp android chart


You can reduce the spacing between the bars that will automatically increase the width of bars.

BarDataSet set = new BarDataSet(vals, "Set A");

UPDATE v3.0.0:

As of this library version, you can control the bar width with the following method:

BarData barData = new BarData(...);

The number you provide for this method represents a certain interval on the x-axis. If your total axis has a range of e.g. 10k, and you set the bar width to 1000, the bar will cover 10% of the total x-axis range.