MPAndroidChart icon indicating copy to clipboard operation
MPAndroidChart copied to clipboard

PieChart: extra padding at top

Open romangromov opened this issue 12 years ago • 9 comments

Hi @PhilJay,

just wanna to say you many thanks for your great library.

I'm playing with PieChart and I found some extra padding above it when using Legend. Could you please help me to figure out how to fix it? screenshot_2014-10-07-20-53-14

romangromov avatar Oct 07 '14 17:10 romangromov

Also the same extra padding appears when I'm trying to align Legend with BOTTOM_CENTER. Another bad news is that Legend starting to overlap PieChart, please take a look at screenshot below screenshot_2014-10-07-20-42-47

romangromov avatar Oct 07 '14 17:10 romangromov

My code is so simple as bundled samples, here it is:

<com.github.mikephil.charting.charts.PieChart
        android:id="@+id/chart"
        android:layout_width="match_parent"
        android:layout_centerInParent="true"
        android:layout_height="345dp" />
mChart = (PieChart) findViewById(R.id.chart);
mChart.setDrawLegend(true);

setData(3, 100); // the same as in examples

mChart.animateXY(1500, 1500);

Legend l = mChart.getLegend();
l.setPosition(LegendPosition.RIGHT_OF_CHART);

Is there any way just to remove this extra padding at top?

Thank you in advance!

romangromov avatar Oct 07 '14 17:10 romangromov

Seems like an issue in the calculateOffsets() method of the PieChart. I'm looking into it.

Regards, Phil

PhilJay avatar Oct 07 '14 18:10 PhilJay

Thank you for taking time!

romangromov avatar Oct 08 '14 06:10 romangromov

Please try out the latest .jar file, the problem should be fixed now.

PhilJay avatar Oct 08 '14 07:10 PhilJay

Hi @PhilJay,

sorry for delay and big thanks for hot fix from your side! Now it works fine for me!

romangromov avatar Oct 14 '14 13:10 romangromov

@PhilJay i want to set some extra padding in barchart bottom..which method ?

LeoYe168 avatar Dec 23 '15 08:12 LeoYe168

@LeoYe168, give a try via Chart.setExtraBottomOffset(n); //n > default 15

Jasper009-So avatar Dec 23 '15 08:12 Jasper009-So

@coolscott 3ks

liuzheng9110 avatar Sep 12 '17 02:09 liuzheng9110