getHighlightByTouchPoint method

  1. @override
Highlight? getHighlightByTouchPoint(
  1. double x,
  2. double y
)
override

Like BarChart.getHighlightByTouchPoint; the highlighter takes the touch position as (y, x).

Implementation

@override
Highlight? getHighlightByTouchPoint(double x, double y) {
  if (data == null) {
    if (isLogEnabled) {
      debugPrint("${Chart.LOG_TAG}: Can't select by touch. No data set.");
    }
    return null;
  }
  final h = highlighter.getHighlight(y, x);
  if (h == null || !isHighlightFullBarEnabled) return h;

  return Highlight.stackedWithPixels(
    h.x,
    h.y,
    h.xPx,
    h.yPx,
    h.dataSetIndex,
    -1,
    h.axis,
  );
}