* Returns items in the same dataset. If the options.intersect parameter is true, we only return items if we intersect something * If the options.intersect is false, we find the nearest item and return the items in that dataset * @function Chart.Interaction.modes.dataset * @param {Chart} cha
(chart, e, options, useFinalPosition)
| 304 | * @return {InteractionItem[]} - items that are found |
| 305 | */ |
| 306 | dataset(chart, e, options, useFinalPosition) { |
| 307 | const position = getRelativePosition(e, chart); |
| 308 | const axis = options.axis || 'xy'; |
| 309 | const includeInvisible = options.includeInvisible || false; |
| 310 | let items = options.intersect |
| 311 | ? getIntersectItems(chart, position, axis, useFinalPosition, includeInvisible) : |
| 312 | getNearestItems(chart, position, axis, false, useFinalPosition, includeInvisible); |
| 313 | |
| 314 | if (items.length > 0) { |
| 315 | const datasetIndex = items[0].datasetIndex; |
| 316 | const data = chart.getDatasetMeta(datasetIndex).data; |
| 317 | items = []; |
| 318 | for (let i = 0; i < data.length; ++i) { |
| 319 | items.push({element: data[i], datasetIndex, index: i}); |
| 320 | } |
| 321 | } |
| 322 | |
| 323 | return items; |
| 324 | }, |
| 325 | |
| 326 | /** |
| 327 | * Point mode returns all elements that hit test based on the event position |
nothing calls this directly
no test coverage detected