@Override public void touch(float x, float y) { if (chart.isHighlightDisable()) return; for (BarDataSet dataSet : getDataSet()) { if (dataSet.isHighlightedVerticalEnable()) { highlight.setTouchX(x); highlight.setTouchY(y); int index = getEntryIndexByCoordinate(x, y) - dataSet.getStartIndexOffset(); if (index < dataSet.getValues().size()) { BarValue barValue = dataSet.getEntryForIndex(index); float xPosition = barValue.getX(); float yPosition = barValue.getY(); if (xPosition > 0 && yPosition > 0) { highlight.setX(xPosition); highlight.setY(yPosition); highlight.setDataIndex(index); chart.highlightValue(highlight); } } } } } });