MCPcopy Create free account
hub / github.com/chartjs/Chart.js / _getActiveElements

Method _getActiveElements

src/plugins/plugin.tooltip.js:1266–1287  ·  view source on GitHub ↗

* Helper for determining the active elements for event * @param {ChartEvent} e - The event to handle * @param {InteractionItem[]} lastActive - Previously active elements * @param {boolean} [replay] - This is a replayed event (from update) * @param {boolean} [inChartArea] - The event is insid

(e, lastActive, replay, inChartArea)

Source from the content-addressed store, hash-verified

1264 * @private
1265 */
1266 _getActiveElements(e, lastActive, replay, inChartArea) {
1267 const options = this.options;
1268
1269 if (e.type === 'mouseout') {
1270 return [];
1271 }
1272
1273 if (!inChartArea) {
1274 // Outside chartArea, the elements set by code stay (eg. by a legend onHover), and the pointer's end.
1275 // The chart's filter leaves out the ones that are hidden, removed, or whose controller is gone.
1276 return this._activeSetByCode ? this.chart._filterActive(lastActive) : [];
1277 }
1278
1279 // Find Active Elements for tooltips
1280 const active = this.chart.getElementsAtEventForMode(e, options.mode, options, replay);
1281
1282 if (options.reverse) {
1283 active.reverse();
1284 }
1285
1286 return active;
1287 }
1288
1289 /**
1290 * Determine if the active elements + event combination changes the

Callers 1

handleEventMethod · 0.95

Calls 2

_filterActiveMethod · 0.80

Tested by

no test coverage detected