• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package com.github.mikephil.charting.components;
2 
3 import android.graphics.Canvas;
4 
5 import com.github.mikephil.charting.data.Entry;
6 import com.github.mikephil.charting.highlight.Highlight;
7 import com.github.mikephil.charting.utils.MPPointF;
8 
9 public interface IMarker {
10 
11     /**
12      * @return The desired (general) offset you wish the IMarker to have on the x- and y-axis.
13      *         By returning x: -(width / 2) you will center the IMarker horizontally.
14      *         By returning y: -(height / 2) you will center the IMarker vertically.
15      */
getOffset()16     MPPointF getOffset();
17 
18     /**
19      * @return The offset for drawing at the specific `point`. This allows conditional adjusting of the Marker position.
20      *         If you have no adjustments to make, return getOffset().
21      *
22      * @param posX This is the X position at which the marker wants to be drawn.
23      *             You can adjust the offset conditionally based on this argument.
24      * @param posY This is the X position at which the marker wants to be drawn.
25      *             You can adjust the offset conditionally based on this argument.
26      */
getOffsetForDrawingAtPoint(float posX, float posY)27     MPPointF getOffsetForDrawingAtPoint(float posX, float posY);
28 
29     /**
30      * This method enables a specified custom IMarker to update it's content every time the IMarker is redrawn.
31      *
32      * @param e         The Entry the IMarker belongs to. This can also be any subclass of Entry, like BarEntry or
33      *                  CandleEntry, simply cast it at runtime.
34      * @param highlight The highlight object contains information about the highlighted value such as it's dataset-index, the
35      *                  selected range or stack-index (only stacked bar entries).
36      */
refreshContent(Entry e, Highlight highlight)37     void refreshContent(Entry e, Highlight highlight);
38 
39     /**
40      * Draws the IMarker on the given position on the screen with the given Canvas object.
41      *
42      * @param canvas
43      * @param posX
44      * @param posY
45      */
draw(Canvas canvas, float posX, float posY)46     void draw(Canvas canvas, float posX, float posY);
47 }
48