First of all its the best library of many I have tried.
I wanted to display values in legend> 5 (Inside Pie Chart). Currently all legend entries are displayed in one line and they do not wrap automatically to next line if there are many entries.
I have tried following legend positions:
Example of Legend Values Wrapping
[] Party A [] Party B [] Party C [] Party D [] Party E (Screen Size reached)
[] Party F and so on
Can you please let me know how can I achieve this in existing code.
The PieChart does not have a rule that does not allow more than 5 legend entries. How many entries can be displayed simply depends on the length of the Strings the legend uses.
At the moment the library does not support a "wrapping" mechanism for overflowing legend entries. If you want to implement it yourself, I suggest you get started inside the Chart.java file.
Around line 730 there is a method called drawLegend() you can modify it to wrap legend entries there.
Regards,
Phil
I was able to find workable solution to wrap entries under BELOW_CHART_LEFT mode.
If any one wants please find attached modification in drawLegend() method.
float entryspace = Utils.calcTextWidth(mLegendLabelPaint,
labels[i]) + mLegend.getXEntrySpace();
if ((entryspace + posX) >= (getWidth() - getOffsetRight())) {
posX = mLegend.getOffsetLeft();
posY += Utils.calcTextHeight(mLegendLabelPaint, labels[i])+mLegend.getYEntrySpace();
}
Copy this code before mLegend.drawLabel() call.
@PhilJay
Thanks for the reply. I found out the entry problem. I was specifying color array of size 5 so only those entries were getting displayed
Hi Phil,
First, These charts are awesome !
Just wondering, has this issue been resolved ?
I am using mpandroidchartlibrary-1-6-5.jar and still having the same issue.
Thanks.

The "issue" occurs because you are reusing colors. Provide a larger color array (different colors would make sense) to display all entries.
Thanks a lot. That works.
Hey Phil,
I'm wraping the legend, but when there are more than one line of legend, the chart gets smaller and smaller. Is there a way to fix the chart size?
If we reusing colors for pie chart legends not coming . Is there any solution to get legends with same color.
Hi Phil,
I am setting some text inside pie chart,
Problem is if text increases then it moves outside the pie slice.
Can we make ellipses true if text increases a particular length.
Hiii i want to set Text like below image in android.
I am used MPchart library, Please help me.
I am using v 'com.github.PhilJay:MPAndroidChart:v2.2.4' and I am still facing the issue mentioned above of legends not being shown if too many. I tried checking the Chart.java class but couldn't find that function drawLegend(). Any help?
I am using latest version of MPAndroidChart and facing a problem in pie chart .
I can able to show only 5 legend but I want to show more legends according to my array list size. code which I used mentioned below:
Legend l = pieChart.getLegend();
l.setWordWrapEnabled(true);
Most helpful comment
The "issue" occurs because you are reusing colors. Provide a larger color array (different colors would make sense) to display all entries.