MPAndroidChart icon indicating copy to clipboard operation
MPAndroidChart copied to clipboard

Unwanted padding on PieChart

Open botondbutuza opened this issue 11 years ago • 3 comments

Hey there!

I'm trying to get a PieChart aligned to the left in a grid-like structure, but the chart displayed is very small, because of extra padding around it taking up the space. I've tried all sorts of different ways of getting rid of the padding, to no avail. Latest try was

health.getViewPortHandler().restrainViewPort(0, 0, 0, 0);

but again, nothing.

Any ideas?

botondbutuza avatar Oct 09 '15 14:10 botondbutuza

Have you tried calling chart.invalidate() afterwards?

PhilJay avatar Oct 09 '15 16:10 PhilJay

Yupp, it doesn't have any effect.

botondbutuza avatar Oct 09 '15 16:10 botondbutuza

I just checked it out. The PieChart does have an offset of 10 by default + the space that is needed for the slices that are "selected" and therefore bigger.

I just fixed this issue. If you now call this: pieDataSet.setSelectionShift(0)

there should be no offset at all. If you have a selection shift (distance) > 0, than this will be the minimum offset.

PhilJay avatar Oct 09 '15 16:10 PhilJay