ChartHighlighter<T extends BarLineScatterCandleBubbleDataProvider> class
Default highlighter for line, scatter, candle and bubble charts.
Strategy: convert the touch to an x value, collect the entry closest to that x value in every data set with highlighting enabled, prefer the y axis whose entries are nearer to the touch, then pick the entry with the smallest pixel distance to the touch. Nothing is selected when that distance exceeds BarLineScatterCandleBubbleDataProvider.maxHighlightDistance.
- Implemented types
- Implementers
Constructors
- ChartHighlighter(T chart)
-
Creates a highlighter for
chart.
Properties
- chart → T
-
The chart whose data and transformers the highlights are searched with.
final
-
data
→ BarLineScatterCandleBubbleData<
IBarLineScatterCandleBubbleDataSet< ?Entry> > -
The chart data the highlights are searched in.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
highlightBuffer
→ List<
Highlight> -
Reused list that collects the candidate highlights of one lookup.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
buildHighlights(
IDataSet< Entry> set, int dataSetIndex, double xVal, Rounding rounding) → List<Highlight> -
Builds a highlight for every entry of
setatxVal, or at the closest x value according toroundingif there is none exactly atxVal. -
getClosestHighlightByPixel(
List< Highlight> closestValues, double x, double y, AxisDependency? axis, double minSelectionDistance) → Highlight? -
Picks the candidate with the smallest getDistance to the pixel position (
x,y). -
getDistance(
double x1, double y1, double x2, double y2) → double - Distance in pixels between two points; the straight line distance here.
-
getHighlight(
double x, double y) → Highlight? -
Returns the highlight for the pixel position (
x,y), or null if nothing is close enough or the chart has no data.override -
getHighlightForX(
double xVal, double x, double y) → Highlight? -
Finds the highlight for the x value
xValclosest to the pixel position (x,y). -
getHighlightPos(
Highlight h) → double -
The pixel coordinate of
hused to compare against the touch when choosing the axis; the y pixel here. -
getHighlightsAtXValue(
double xVal, double x, double y) → List< Highlight> -
Collects one candidate highlight per entry at
xValfrom every data set with highlighting enabled. -
getMinimumDistance(
List< Highlight> closestValues, double pos, AxisDependency axis) → double -
Returns the smallest pixel distance between
posand the getHighlightPos of the candidates onaxis, orFloat.MAX_VALUEif none belongs to that axis. -
getValsForTouch(
double x, double y) → MPPointD -
Converts the pixel position (
x,y) to values using the left axis transformer. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited