# chartjs-plugin-annotation-drag2

> Annotations for Chart.js

Latest version **1.5.3** (published 2022-06-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install chartjs-plugin-annotation-drag2
pnpm add chartjs-plugin-annotation-drag2
yarn add chartjs-plugin-annotation-drag2
bun add chartjs-plugin-annotation-drag2
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.5.3 |
| Published | 2022-06-21 |
| First published | 2022-06-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 186.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Taylor Johnson |
| Maintainers | becker632 |

## Links

- npm: https://www.npmjs.com/package/chartjs-plugin-annotation-drag2
- Repository: https://github.com/becker63/chartjs-plugin-annotation-drag
- Homepage: https://www.chartjs.org/chartjs-plugin-annotation/index
- npm.io page: https://npm.io/package/chartjs-plugin-annotation-drag2

## Dependencies (1)

- [chartjs-plugin-annotation-drag2](https://npm.io/package/chartjs-plugin-annotation-drag2.md) ^1.1.9

## Recent versions

- 1.5.3 (latest) — 2022-06-21
- 1.5.2 — 2022-06-21
- 1.4.9 — 2022-06-20
- 1.4.8 — 2022-06-20
- 1.4.7 — 2022-06-20
- 1.4.6 — 2022-06-20
- 1.4.5 — 2022-06-20
- 1.4.4 — 2022-06-20
- 1.4.3 — 2022-06-20
- 1.4.2 — 2022-06-19
- 1.4.1 — 2022-06-17
- 1.4.0 — 2022-06-17
- 1.3.9 — 2022-06-17
- 1.3.8 — 2022-06-16
- 1.3.7 — 2022-06-16
- … 31 more at https://npm.io/package/chartjs-plugin-annotation-drag2/versions

## README

1. everytime the mouse updates a function called ***updateListeners*** is called with 3 variables passed to it, these are passed everywhere throughout the lib:
    1. state: whether the annotation line has been clicked on or moved over 
    2. args.event: what event has been detected
    3. options: chart options

2. this does some stuff to check in your annotation options what event you have selected to detect

3. then a function called ***handleEvent*** is called with the same options passed as updatelistener

4. ***handleEvent*** sends you off to one of 2 functions depending on if its a mouseover or click: ***handleMoveEvents*** and ***handleClickEvents***.  ***handleMoveEvents*** is a little weirder but it all ends up going to what you see in step 4

5. **MORE WORK NEEDED**: both ***handleMoveEvents*** and ***handleClickEvents*** pass a parameter to a function called ***getElements*** called **options.interaction** depending on the type of event (mouseover or mouseclick). These find whatever element the user is selecting and depending on this element the method to find that will be diffrent, for example 'mouseclick' does a 'getnearest' mode. Problem is I have no idea where this 'interaction' param is being generated.

6. Now with what annotation the user has touched from ***getElements*** which executes the function found in there annotation options, and allows you to pass along the options of your chart to be changed.

---
_Source: https://npm.io/package/chartjs-plugin-annotation-drag2 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
