MCPcopy
hub / github.com/chartjs/Chart.js / getNearestItems

Function getNearestItems

src/core/core.interaction.js:209–217  ·  view source on GitHub ↗

* Helper function to get the items nearest to the event position considering all visible items in the chart * @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 axes along which to

(chart, position, axis, intersect, useFinalPosition, includeInvisible)

Source from the content-addressed store, hash-verified

207 * @return {InteractionItem[]} the nearest items
208 */
209function getNearestItems(chart, position, axis, intersect, useFinalPosition, includeInvisible) {
210 if (!includeInvisible && !chart.isPointInArea(position)) {
211 return [];
212 }
213
214 return axis === 'r' && !intersect
215 ? getNearestRadialItems(chart, position, axis, useFinalPosition)
216 : getNearestCartesianItems(chart, position, axis, intersect, useFinalPosition, includeInvisible);
217}
218
219/**
220 * Helper function to get the items matching along the given X or Y axis

Callers 3

indexFunction · 0.85
datasetFunction · 0.85
nearestFunction · 0.85

Calls 3

getNearestRadialItemsFunction · 0.85
getNearestCartesianItemsFunction · 0.85
isPointInAreaMethod · 0.80

Tested by

no test coverage detected