function getAxisItems(chart, position, axis, intersect, useFinalPosition) {
  const items = [];
  const rangeMethod = axis === 'x' ? 'inXRange' : 'inYRange';
  let intersectsItem = false;

  evaluateInteractionItems(chart, axis, position, (element, datasetIndex, index) => {
    if (element[rangeMethod] && element[rangeMethod](position[axis], useFinalPosition)) {
      items.push({element, datasetIndex, index});
      intersectsItem = intersectsItem || element.inRange(position.x, position.y, useFinalPosition);
    }
  });

  // If we want to trigger on an intersect and we don't have any items
  // that intersect the position, return nothing
  if (intersect && !intersectsItem) {
    return [];
  }
  return items;
}
Helper function to get the items matching along the given X or Y axis
@param {Chart} chart - the chart to look at elements from
@param {Point} position - the point to be nearest to, in relative coordinates
@param {string} axis - the axis to match
@param {boolean} [intersect] - if true, only consider items that intersect the position
@param {boolean} [useFinalPosition] - use the element's animation target instead of current position
@return {InteractionItem[]} the nearest items