1 package com.github.mikephil.charting.listener; 2 3 import android.view.MotionEvent; 4 5 /** 6 * Listener for callbacks when doing gestures on the chart. 7 * 8 * @author Philipp Jahoda 9 */ 10 public interface OnChartGestureListener { 11 12 /** 13 * Callbacks when a touch-gesture has started on the chart (ACTION_DOWN) 14 * 15 * @param me 16 * @param lastPerformedGesture 17 */ onChartGestureStart(MotionEvent me, ChartTouchListener.ChartGesture lastPerformedGesture)18 void onChartGestureStart(MotionEvent me, ChartTouchListener.ChartGesture lastPerformedGesture); 19 20 /** 21 * Callbacks when a touch-gesture has ended on the chart (ACTION_UP, ACTION_CANCEL) 22 * 23 * @param me 24 * @param lastPerformedGesture 25 */ onChartGestureEnd(MotionEvent me, ChartTouchListener.ChartGesture lastPerformedGesture)26 void onChartGestureEnd(MotionEvent me, ChartTouchListener.ChartGesture lastPerformedGesture); 27 28 /** 29 * Callbacks when the chart is longpressed. 30 * 31 * @param me 32 */ onChartLongPressed(MotionEvent me)33 void onChartLongPressed(MotionEvent me); 34 35 /** 36 * Callbacks when the chart is double-tapped. 37 * 38 * @param me 39 */ onChartDoubleTapped(MotionEvent me)40 void onChartDoubleTapped(MotionEvent me); 41 42 /** 43 * Callbacks when the chart is single-tapped. 44 * 45 * @param me 46 */ onChartSingleTapped(MotionEvent me)47 void onChartSingleTapped(MotionEvent me); 48 49 /** 50 * Callbacks then a fling gesture is made on the chart. 51 * 52 * @param me1 53 * @param me2 54 * @param velocityX 55 * @param velocityY 56 */ onChartFling(MotionEvent me1, MotionEvent me2, float velocityX, float velocityY)57 void onChartFling(MotionEvent me1, MotionEvent me2, float velocityX, float velocityY); 58 59 /** 60 * Callbacks when the chart is scaled / zoomed via pinch zoom / double-tap gesture. 61 * 62 * @param me 63 * @param scaleX scalefactor on the x-axis 64 * @param scaleY scalefactor on the y-axis 65 */ onChartScale(MotionEvent me, float scaleX, float scaleY)66 void onChartScale(MotionEvent me, float scaleX, float scaleY); 67 68 /** 69 * Callbacks when the chart is moved / translated via drag gesture. 70 * 71 * @param me 72 * @param dX translation distance on the x-axis 73 * @param dY translation distance on the y-axis 74 */ onChartTranslate(MotionEvent me, float dX, float dY)75 void onChartTranslate(MotionEvent me, float dX, float dY); 76 } 77