public class ChartHighlighter<T extends BarLineScatterCandleBubbleDataProvider> extends java.lang.Object implements IHighlighter
| Modifier and Type | Field and Description |
|---|---|
protected T |
mChart
instance of the data-provider
|
protected java.util.List<Highlight> |
mHighlightBuffer
buffer for storing previously highlighted values
|
| Constructor and Description |
|---|
ChartHighlighter(T chart) |
| Modifier and Type | Method and Description |
|---|---|
protected java.util.List<Highlight> |
buildHighlights(IDataSet set,
int dataSetIndex,
float xVal,
DataSet.Rounding rounding)
An array of `Highlight` objects corresponding to the selected xValue and dataSetIndex.
|
Highlight |
getClosestHighlightByPixel(java.util.List<Highlight> closestValues,
float x,
float y,
YAxis.AxisDependency axis,
float minSelectionDistance)
Returns the Highlight of the DataSet that contains the closest value on the
y-axis.
|
protected BarLineScatterCandleBubbleData |
getData() |
protected float |
getDistance(float x1,
float y1,
float x2,
float y2)
Calculates the distance between the two given points.
|
Highlight |
getHighlight(float x,
float y)
Returns a Highlight object corresponding to the given x- and y- touch positions in pixels.
|
protected Highlight |
getHighlightForX(float xVal,
float x,
float y)
Returns the corresponding Highlight for a given xVal and x- and y-touch position in pixels.
|
protected float |
getHighlightPos(Highlight h) |
protected java.util.List<Highlight> |
getHighlightsAtXValue(float xVal,
float x,
float y)
Returns a list of Highlight objects representing the entries closest to the given xVal.
|
protected float |
getMinimumDistance(java.util.List<Highlight> closestValues,
float pos,
YAxis.AxisDependency axis)
Returns the minimum distance from a touch value (in pixels) to the
closest value (in pixels) that is displayed in the chart.
|
protected MPPointD |
getValsForTouch(float x,
float y)
Returns a recyclable MPPointD instance.
|
protected T extends BarLineScatterCandleBubbleDataProvider mChart
protected java.util.List<Highlight> mHighlightBuffer
public ChartHighlighter(T chart)
public Highlight getHighlight(float x, float y)
IHighlightergetHighlight in interface IHighlighterprotected MPPointD getValsForTouch(float x, float y)
x - y - protected Highlight getHighlightForX(float xVal, float x, float y)
xVal - x - y - protected float getMinimumDistance(java.util.List<Highlight> closestValues, float pos, YAxis.AxisDependency axis)
closestValues - pos - axis - protected float getHighlightPos(Highlight h)
protected java.util.List<Highlight> getHighlightsAtXValue(float xVal, float x, float y)
xVal - the transformed x-value of the x-touch positionx - touch positiony - touch positionprotected java.util.List<Highlight> buildHighlights(IDataSet set, int dataSetIndex, float xVal, DataSet.Rounding rounding)
set - dataSetIndex - xVal - rounding - public Highlight getClosestHighlightByPixel(java.util.List<Highlight> closestValues, float x, float y, YAxis.AxisDependency axis, float minSelectionDistance)
closestValues - contains two Highlight objects per DataSet closest to the selected x-position (determined by
rounding up an down)x - y - axis - the closest axisminSelectionDistance - protected float getDistance(float x1,
float y1,
float x2,
float y2)
x1 - y1 - x2 - y2 - protected BarLineScatterCandleBubbleData getData()