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

Function evaluateInteractionItems

src/core/core.interaction.js:74–87  ·  view source on GitHub ↗

* Helper function to select candidate elements for interaction * @param {Chart} chart - the chart * @param {string} axis - the axis mode. x|y|xy|r * @param {Point} position - the point to be nearest to, in relative coordinates * @param {function} handler - the callback to execute for each visibl

(chart, axis, position, handler, intersect)

Source from the content-addressed store, hash-verified

72 * @param {boolean} [intersect] - consider intersecting items
73 */
74function evaluateInteractionItems(chart, axis, position, handler, intersect) {
75 const metasets = chart.getSortedVisibleDatasetMetas();
76 const value = position[axis];
77 for (let i = 0, ilen = metasets.length; i < ilen; ++i) {
78 const {index, data} = metasets[i];
79 const {lo, hi} = binarySearch(metasets[i], axis, value, intersect);
80 for (let j = lo; j <= hi; ++j) {
81 const element = data[j];
82 if (!element.skip) {
83 handler(element, index, j);
84 }
85 }
86 }
87}
88
89/**
90 * Get a distance metric function for two points based on the

Callers 4

getIntersectItemsFunction · 0.85
getNearestRadialItemsFunction · 0.85
getNearestCartesianItemsFunction · 0.85
getAxisItemsFunction · 0.85

Calls 2

binarySearchFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…