java - MPAndroidChart - How add put and show legends in a PieChart -


i´m read various tutoriais of show same example. legend array put in constructor of:

new piedata(legendvalues, ipiedataset dataset)

but piedata doesn't have constructor.

does have sample code issue?

i'm assuming using latest 3.0.0-beta1 version of library. version lot of (breaking) changes made support float x-values.

specifically, piedata constructor has changed , accepts ipiedataset. labels set pieentry has pieentry(float value, string label) constructor. here's small example illustrating how set labels in latest version of library:

arraylist<pieentry> entries = new arraylist<>(); entries.add(new pieentry(25, "android 5.0")); entries.add(new pieentry(25, "android 5.1")); entries.add(new pieentry(25, "android 6.0")); piedataset dataset = new piedataset(entries, "android versions"); piedata data = new piedata(dataset); 

Comments