Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MPAndroidChart legend customization

I am using MPAndroidChart library. I want customize legends in MPAndroidChart. In MPAndroidChart library i tried to set the position of legends. by given code legend.setPosition(LegendPosition.BELOW_CHART_CENTER) but unable to do it. I have to set legends as shown in following image

help will be appreciate enter image description here

like image 963
Zia Avatar asked Mar 19 '15 07:03

Zia


1 Answers

In your case I would recommend that you disable the Legend that is drawn by the chart and instead come up with your own implementation.

chart.getLegend().setEnabled(false)

In the case shown above you will probably need a ListView that takes data from the charts Legend object and displays it.

When you have a look at the Legend class you will notice that it has member variables for colors and labels.

You can retrieve those arrays (getColors(), getLegendLabels()) and use them to be displayed in the ListView.

like image 157
Philipp Jahoda Avatar answered Sep 19 '22 04:09

Philipp Jahoda