getHighlightByTouchPoint method

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

Returns the Highlight object (contains x-index and DataSet index) of the selected value at the given touch point inside the BarChart.

@param x @param y @return

Implementation

@override
Highlight? getHighlightByTouchPoint(double x, double y) {
  if (getBarData() == null) {
    return null;
  } else {
    Highlight? h = highlighter!.getHighlight(x, y);
    if (h == null || !isHighlightFullBarEnabled()) return h;

    // For isHighlightFullBarEnabled, remove stackIndex
    return Highlight(
        x: h.x,
        y: h.y,
        xPx: h.xPx,
        yPx: h.yPx,
        dataSetIndex: h.dataSetIndex,
        stackIndex: -1,
        axis: h.axis);
  }
}