function getNearestItems(chart, position, intersect, distanceMetric) {
	var minDistance = Number.POSITIVE_INFINITY;
	var nearestItems = [];

	parseVisibleItems(chart, function(element) {
		if (intersect && !element.inRange(position.x, position.y)) {
			return;
		}

		var center = element.getCenterPoint();
		var distance = distanceMetric(position, center);

		if (distance < minDistance) {
			nearestItems = [element];
			minDistance = distance;
		} else if (distance === minDistance) {
			// Can have multiple items at the same distance in which case we sort by size
			nearestItems.push(element);
		}
	});

	return nearestItems;
}
Helper function to get the items nearest to the event position considering all visible items in teh chart
@param chart {Chart} the chart to look at elements from
@param position {Point} the point to be nearest to
@param intersect {Boolean} if true, only consider items that intersect the position
@param distanceMetric {Function} function to provide the distance between points
@return {ChartElement[]} the nearest items