android - MPAndroidChart OnClickListener is not working for PieChart -
i use mpandroidchart in project. there 4 graphs,displays information. want show detailed information user when clicks on specific chart. have used view.setonclicklistener();
not working. there other method listen click events chart. found onvalueselected();
method in mpchart documentation not useful me,because want id of chart clicked.
i have used following
chart = (piechart) findviewbyid(r.id.chart); chart.setonclicklistener(mainactivity.this); chart.settouchenabled(true); public void onclick(view v) { toast.maketext(mainactivity.this,"clicked",toast.length_short).show(); }
also other way is
chart.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { toast.maketext(mainactivity.this,"clicked",toast.length_short).show(); } });
but no luck.
i have tried onclicklistener it's not working use following code comes library itself.
mchart.setonchartgesturelistener(new onchartgesturelistener() { @override public void oncharttranslate(motionevent me, float dx, float dy) { // todo auto-generated method stub } @override public void onchartsingletapped(motionevent me) { // todo auto-generated method stub } @override public void onchartscale(motionevent me, float scalex, float scaley) { // todo auto-generated method stub } @override public void onchartlongpressed(motionevent me) { // todo auto-generated method stub } @override public void onchartfling(motionevent me1, motionevent me2, float velocityx, float velocityy) { // todo auto-generated method stub } @override public void onchartdoubletapped(motionevent me) { // todo auto-generated method stub } });
Comments
Post a Comment