Mpandroidchart: Unwanted padding on PieChart

Created on 9 Oct 2015  路  3Comments  路  Source: PhilJay/MPAndroidChart

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?

Most helpful comment

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.

All 3 comments

Have you tried calling chart.invalidate() afterwards?

Yupp, it doesn't have any effect.

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AndroidJiang picture AndroidJiang  路  3Comments

tsengvn picture tsengvn  路  3Comments

galex picture galex  路  3Comments

manucheri picture manucheri  路  3Comments

JungYongWook picture JungYongWook  路  3Comments