getEntryForHighlight method

  1. @override
Entry? getEntryForHighlight(
  1. Highlight highlight
)
override

Returns the entry a highlight refers to. For radar charts Highlight.x holds the entry index (truncated towards zero), not an x value.

Returns the entry, or null when Highlight.dataSetIndex or the entry index is out of range.

Implementation

@override
Entry? getEntryForHighlight(Highlight highlight) {
  final set = getDataSetByIndex(highlight.dataSetIndex);
  if (set == null) return null;
  final index = kotlinFloatToInt(highlight.x);
  return (index >= 0 && index < set.entryCount)
      ? set.getEntryForIndex(index)
      : null;
}