I am using MPAndroidChart library.
I have used Horizontal bar charts in my dashboard.
I want to navigate to another activity by clicking particular bar of that chart.
How can i do this??
That's actually pretty easy, all you have to do is use the OnChartValueSelectedListener
and start your new Activity
from the callback methods.
You can find an example of how that works here.
Basically, implement the listener in your class that holds the chart:
public class SomeClass implements OnChartValueSelectedListener {
Set the listener to the chart:
chart.setOnChartValueSelectedListener(this);
Start your new activity in the callback:
@Override
public void onValueSelected(Entry e, int dataSetIndex, Highlight h) {
// start new activity
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With