getHighlightByTouchPoint method

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

Like Chart.getHighlightByTouchPoint, but while isHighlightFullBarEnabled is on the highlight of a stacked bar has a stack index of -1, so it selects the whole bar.

Implementation

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

  final h = highlighter.getHighlight(x, y);
  if (h == null || !isHighlightFullBarEnabled) return h;

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