Hitesh Bhalala
Hitesh Bhalala

Reputation: 2870

How to add legend for Pie chart in Android plot?

enter image description here

I am using Android Plot(http://androidplot.com/) library to draw a Pie chart and Pie chart draw is fine but I want legend and its customisation as shown in attached image so please guide me to do same in Android Plot library.

Upvotes: 1

Views: 2015

Answers (1)

Nick
Nick

Reputation: 8317

Pie chart legends were added in Androidplot 1.5.0 but is disabled by default. To enable:

pieChart.legend.setVisible(true);

Configuration of the legend works the same way it does for other series types in Androidplot. For example, you can configure a single column with 4 rows:

pie.getLegend().setTableModel(new DynamicTableModel(1, 4));

Or a single row with 4 columns (shown below):

pie.getLegend().setTableModel(new DynamicTableModel(4, 1));

enter image description here

Upvotes: 1

Related Questions