Chart.js/docs/configuration
Josh Kelley c057c96693
Interaction functions (#10046)
* Refactor get...Items functions to take events rather than positions

To work toward exposing something like the get...Items functions.

* Switch getAxisItems to use optimizedEvaluateItems

optimizedEvaluateItems falls back to evaluating all items for unsorted items, and sorting / optimizing ought to be okay, so this ought to be equivalent.

* Performance

* Consolidate getRelativePosition

helpers.dom.js's getRelativePosition already had logic to handle ChartEvent vs. Event (as demonstrated by the `native` check within `getCanvasPosition`), so it's redundant for core.interaction.js to have its own `native` check.

Update `getRelativePosition` to use the same `native` check as core.interaction.js's version.  As best as I can tell, the ChartEvent's x and y are populated from `getRelativePosition`, so the previous `getCanvasPosition` was effectively just duplicating `getRelativePosition'`s work.  I added a test to verify this; it depends on a local, not-yet-submitted change in chartjs-test-utils' `triggerMouseEvent` to return the mouse event that it triggers.

* Add an API to refactor duplicate isPointInArea

* Rename and update JSDoc to prepare for making this public

* Give functions a consistent, generic interface

* Export functions for discussion

* Code review feedback

Add a non-null assertion, as requested in code review.

Add JSDoc to clarify that `getCanvasPosition` now expects a native `Event`, not a `ChartEvent`.  Add `@ts-ignore`; `getCanvasPosition` relied on some loose conversions between `Event`, `TouchEvent`, and `Touch` that would require several changes to make TypeScript happy.

* Code review feedback

Return the event directly, to speed up the code a bit.  Add JSDoc to help communicate its intent.  Update various comments.

* Finalize exports; add docs and TypeScript

* Update src/helpers/helpers.dom.js

* Update src/helpers/helpers.dom.js

Only thing needed actually is the update of chartjs-test-utils to 0.4.0

* Bump chartjs-test-utils dependency

To get supporting work from https://github.com/chartjs/chartjs-test-utils/pull/19

Co-authored-by: Jukka Kurkela <jukka.kurkela@gmail.com>
2022-03-24 09:02:30 -04:00
..
animations.md Update animations.md (#10184) 2022-02-22 08:37:33 -05:00
canvas-background.md Fix typos in canvas-background.md (#8837) 2021-04-07 19:51:45 +03:00
decimation.md Adding threshold option to decimation plugin (#9327) 2021-07-04 13:19:35 -04:00
device-pixel-ratio.md Switch docs to Vuepress to match other chart.js repositories (#8751) 2021-03-30 10:32:39 -04:00
elements.md Add borderJoinStyle option for arc elements (#9877) 2021-12-05 08:56:37 -05:00
index.md typo Cofiguration (#10045) 2022-01-04 11:43:59 -05:00
interactions.md Interaction functions (#10046) 2022-03-24 09:02:30 -04:00
layout.md Add layout.autoPadding option (#9716) 2021-10-04 14:01:10 -04:00
legend.md change namespace and chart types that override legend defaults (#9791) 2021-10-25 19:48:51 +03:00
locale.md Switch docs to Vuepress to match other chart.js repositories (#8751) 2021-03-30 10:32:39 -04:00
responsive.md Changed var to const/let in the docs (#9744) 2021-10-13 14:51:33 -04:00
subtitle.md Fix typos found by codespell (#10103) 2022-01-27 09:24:55 -05:00
title.md Changed var to const/let in the docs (#9744) 2021-10-13 14:51:33 -04:00
tooltip.md Improvements to tooltip positioners (#9944) 2021-12-06 07:39:06 -05:00