Mpandroidchart: How can i get the value in BarChart and show it in a TextView?

Created on 27 Jun 2016  路  4Comments  路  Source: PhilJay/MPAndroidChart

in the left-top ,i put a textView ,my purpose is :8ball: when i touch the bar,i can monitoring it's value,and show this value in the mentioned above.thx!On the other hand,this value is dynamic,when i touch the distinct bar,the textview's value will be changed...

Most helpful comment

Without any further information, I have no idea, I can only guess.

Have you set the listener?

chart.setOnChartValueSelectedListener(this)

All 4 comments

https://github.com/PhilJay/MPAndroidChart/wiki/Interaction-with-the-Chart

@Override
public void onValueSelected(Entry e, int dataSetIndex, Highlight h) {
    myTextView.setText("" + e.getVal());
}

Unfortunately,i have do this in my code,but this method seems not work...also,
@Override public void onValueSelected(Entry e, int dataSetIndex, Highlight h) { float val = e.getVal(); Log.v("1...................","bar was touched:"+Float.toString(val)); }
why i cannot see any log in my studio?

Without any further information, I have no idea, I can only guess.

Have you set the listener?

chart.setOnChartValueSelectedListener(this)

Oh my god...,how can i be so stupid....thx very much!!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tsengvn picture tsengvn  路  3Comments

thanhcly920 picture thanhcly920  路  3Comments

AndroidJiang picture AndroidJiang  路  3Comments

rohitkumarbhagat picture rohitkumarbhagat  路  3Comments

chathudan picture chathudan  路  3Comments