Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 405
Rakesh Avatar asked Mar 24 '15 09:03

Rakesh


People also ask

How do you change the width of a bar?

Click on any bar in the Bar Chart and right click on it, then select Format Data Series from the right-clicking menu. See screenshot: 2. In the popping up Format Data Series pane, move the Zoom bar of the Gap Width to the left side until the bar width meets your needs under the Series Options section.

How do I change the width of a bar in SPSS?

Changing the bins: In SPSS, you can easily change the number of bins and the width of the bins that are displayed in your histogram. To do so, double-click your histogram in the output window. This will open a “Chart Editor”, where you can change the appearance of just about everything in your chart.

How do you increase the width of a graph bar?

Larger bars The solution for this is to click the Excel chart's X axis, right click and choose Format Axis. Select Axis Options and then click on Text Axis to select it. This changes the way the axis is plotted giving wider bars. You can then adjust the gap width if necessary to make them wider.

How do I change the width of a bar in tableau?

1) On the Marks Card for the Bar marks put a pill like MIN(Number of Records) on the Size Shelf. This gives a value for Tableau to work with to adjust the thickness. 2) Drag the Size slider all the way to the right.


1 Answers

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

BarDataSet set = new BarDataSet(vals, "Set A");
set.setBarSpacePercent(50f);

UPDATE v3.0.0:

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

BarData barData = new BarData(...);
barData.setBarWidth(1f);

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.

like image 88
abhi Avatar answered Sep 23 '22 07:09

abhi