-
Notifications
You must be signed in to change notification settings - Fork 337
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6c1f360
commit b182cd6
Showing
3 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Developers | ||
|
||
## Access to the annotation elements | ||
|
||
The annotation plugin uses Chart.js elements to draw the annotation requested by the user. The following APIs allows the user to get the created annotation elements to use in callbacks or for other purposes. | ||
The APIs are available in the annotation plugin instance. | ||
|
||
#### Script Tag | ||
|
||
```html | ||
<script> | ||
// get annotation plugin instance | ||
const annotationPlugin = window['chartjs-plugin-annotation']; | ||
</script> | ||
``` | ||
|
||
#### Bundlers (Webpack, Rollup, etc.) | ||
|
||
```javascript | ||
// get annotation plugin instance | ||
import annotationPlugin from 'chartjs-plugin-annotation'; | ||
``` | ||
|
||
### `.getAnnotations(chart: Chart): AnnotationElement[]` | ||
|
||
It provides all annotation elements configured by the plugin options, even if the annotations are not visible. | ||
|
||
```javascript | ||
const myLineChart = new Chart(ctx, config); | ||
// get all annotation elements | ||
const elements = annotationPlugin.getAnnotations(myLineChart); | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters