44import android .graphics .Color ;
55import android .graphics .Typeface ;
66import android .os .Bundle ;
7+ import android .util .Log ;
78import android .view .Menu ;
89import android .view .MenuItem ;
910import android .view .WindowManager ;
1516import com .github .mikephil .charting .data .BarData ;
1617import com .github .mikephil .charting .data .BarDataSet ;
1718import com .github .mikephil .charting .data .BarEntry ;
19+ import com .github .mikephil .charting .data .Entry ;
20+ import com .github .mikephil .charting .interfaces .OnChartValueSelectedListener ;
1821import com .github .mikephil .charting .utils .Legend ;
1922import com .github .mikephil .charting .utils .Legend .LegendPosition ;
2023import com .github .mikephil .charting .utils .XLabels ;
2326
2427import java .util .ArrayList ;
2528
26- public class BarChartActivityMultiDataset extends DemoBase implements OnSeekBarChangeListener {
29+ public class BarChartActivityMultiDataset extends DemoBase implements OnSeekBarChangeListener , OnChartValueSelectedListener {
2730
2831 private BarChart mChart ;
2932 private SeekBar mSeekBarX , mSeekBarY ;
@@ -46,6 +49,7 @@ protected void onCreate(Bundle savedInstanceState) {
4649 mSeekBarY .setOnSeekBarChangeListener (this );
4750
4851 mChart = (BarChart ) findViewById (R .id .chart1 );
52+ mChart .setOnChartValueSelectedListener (this );
4953 mChart .setDescription ("" );
5054
5155 // disable the drawing of values
@@ -235,4 +239,14 @@ public void onStopTrackingTouch(SeekBar seekBar) {
235239 // TODO Auto-generated method stub
236240
237241 }
242+
243+ @ Override
244+ public void onValueSelected (Entry e , int dataSetIndex ) {
245+ Log .i ("Activity" , "Selected: " + e .toString () + ", dataSet: " + dataSetIndex );
246+ }
247+
248+ @ Override
249+ public void onNothingSelected () {
250+ Log .i ("Activity" , "Nothing selected." );
251+ }
238252}
0 commit comments