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

Function nearest

src/core/core.interaction.js:352–357  ·  view source on GitHub ↗

* nearest mode returns the element closest to the point * @function Chart.Interaction.modes.intersect * @param {Chart} chart - the chart we are returning items from * @param {Event} e - the event we are find things at * @param {InteractionOptions} options - options to use * @param {bo

(chart, e, options, useFinalPosition)

Source from the content-addressed store, hash-verified

350 * @return {InteractionItem[]} - items that are found
351 */
352 nearest(chart, e, options, useFinalPosition) {
353 const position = getRelativePosition(e, chart);
354 const axis = options.axis || 'xy';
355 const includeInvisible = options.includeInvisible || false;
356 return getNearestItems(chart, position, axis, options.intersect, useFinalPosition, includeInvisible);
357 },
358
359 /**
360 * x mode returns the elements that hit-test at the current x coordinate

Callers

nothing calls this directly

Calls 2

getRelativePositionFunction · 0.85
getNearestItemsFunction · 0.85

Tested by

no test coverage detected