android - How can I have a multiple line Label in a PieChart in AChartEngine? -
i have pie chart using achartengine i'm happy with. i've chosen style without legend , labels (the text connected corresponding pie wedge little line) formatted "example info point - 25%"
i label string via:
mseries.add(name + " - " + double.tostring(value), value);
but name long value doesn't display. "...". since value important, want set on new line show.
i'm picturing labels like:
short name 10%
too long of na... 25%
also fine:
too long of a name 25%
or:
too long of a name - 25%
if wrap long names new lines, better! concerned getting value display.
i tried add together new line \n or system.getproperty("line.separator") piechart still renders label 1 line. \n not getting displayed text, it's it's not there. according other questions, supposedly works on other chart types, no 1 claiming works pies, doesn't seem based on efforts.
i've played other rendering options built achartengine. such 'setdisplayvalues(true)', puts values right on pie wedges. don't how looks, pie has tiny wedges, values rendered on top of each other.
any insight on how can create labels on achartengine piechart multi-line (or other way forcefulness value display) appreciated! give thanks much can help!
it's not wanted, since few months have gone by, i've come alternative. posterity, leave here reply own question not take in case out there someday share real solution.
since couldn't find way ensure labels on pie chart showed percent values, have info toast when wedge clicked. here simple plenty code:
private void addpieclicklisteners(final graphicalview mchartview){ mchartview.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { seriesselection seriesselection = mchartview.getcurrentseriesandpoint(); if (seriesselection == null) { // nothing, possible toast: // toast.maketext(context,"no chart element clicked",toast.length_short).show(); } else { toast.maketext(context, integer.tostring((int)math.round(seriesselection.getvalue())) + "% " + mseries.getcategory(seriesselection.getpointindex()), toast.length_short).show(); } } });
i phone call method, along other functions set pie chart, in oncreateview(), since in fragment.
cheers.
android charts newline achartengine pie-chart
No comments:
Post a Comment