* 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)
| 1181 | * @private |
| 1182 | */ |
| 1183 | _getActiveElements(e, lastActive, replay, inChartArea) { |
| 1184 | const options = this.options; |
| 1185 | |
| 1186 | if (e.type === 'mouseout') { |
| 1187 | return []; |
| 1188 | } |
| 1189 | |
| 1190 | if (!inChartArea) { |
| 1191 | // Let user control the active elements outside chartArea. Eg. using Legend. |
| 1192 | // But make sure that active elements are still valid. |
| 1193 | return lastActive.filter(i => |
| 1194 | this.chart.data.datasets[i.datasetIndex] && |
| 1195 | this.chart.getDatasetMeta(i.datasetIndex).controller.getParsed(i.index) !== undefined |
| 1196 | ); |
| 1197 | } |
| 1198 | |
| 1199 | // Find Active Elements for tooltips |
| 1200 | const active = this.chart.getElementsAtEventForMode(e, options.mode, options, replay); |
| 1201 | |
| 1202 | if (options.reverse) { |
| 1203 | active.reverse(); |
| 1204 | } |
| 1205 | |
| 1206 | return active; |
| 1207 | } |
| 1208 | |
| 1209 | /** |
| 1210 | * Determine if the active elements + event combination changes the |
no test coverage detected