Reputation: 257
Can you tell how to give space between the bars and fit to the screen.
Issue
I had reduced bar width with chart.getLayoutParams().width=70
. my graph compressed and it is not looking good. I want to give space between them so that i will look good
Upvotes: 2
Views: 4524
Reputation: 2308
As per the latest MpChart Library, you should use
val data = BarData(dataSets)
data.barWidth = 0.7f //bar width
data.getGroupWidth(0f, 2f)//space between bars
Above code is in kotlin
Upvotes: 0
Reputation: 9228
You can use this:
chart.getXAxis().setSpaceMax(1);
or follow the solution proposed by PhilJay in the related GitHub issue:
Space between individual bars:
barDataSet.setBarSpacePercent(...);
Space between DataSets:
barData.setGroupSpace(...);
Values in percent.
Upvotes: 0