I m using MPANdroidChartLibrary, but facing issues when showing vertical legends in the bottom of the chart. The last legend cut off.
See attached image:
As the last legend is cut after AM registration in small devices. I follow Answer1
3: MpAndroidChart Piechart legends cutting issue at the bottom center and Answer2 posts on stack overflow but nothing works for me.
Surprisingly, This issue only comes on smaller devices even after using scroll view around the chart while on large device like above 6 inch all legends are visible properly.
Add as much offset as you legend grows.
there are two methods add the specified padding at the top and bottom of the chart
mPiecPieChart.setExtraBottomOffset(12f);//from bottom side if legends are bottom side
mPiecPieChart.setExtraTopOffset(12f);//if legends are on top side or change both if legend are on both sides
by this line of code you can set margin between below line and legend last entry!
legend.setYOffset(50f);
as your legends increase you can increase value and on reducing legend entries you can reduce this value also!
Legend legend = chart.getLegend();
legend.setVerticalAlignment(Legend.LegendVerticalAlignment.BOTTOM);
legend.setHorizontalAlignment(Legend.LegendHorizontalAlignment.CENTER);
legend.setOrientation(Legend.LegendOrientation.VERTICAL);
legend.setDrawInside(false);
legend.setYOffset(50f);//here value changes
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With