forked from chartjs/chartjs-plugin-annotation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
49 lines (41 loc) · 1.17 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Get the chart variable
var Chart = require('chart.js');
Chart = typeof Chart === 'function' ? Chart : window.Chart;
// Configure plugin namespace
Chart.Annotation = Chart.Annotation || {};
Chart.Annotation.drawTimeOptions = {
afterDraw: 'afterDraw',
afterDatasetsDraw: 'afterDatasetsDraw',
beforeDatasetsDraw: 'beforeDatasetsDraw'
};
Chart.Annotation.defaults = {
drawTime: 'afterDatasetsDraw',
dblClickSpeed: 350, // ms
events: [],
annotations: []
};
Chart.Annotation.labelDefaults = {
backgroundColor: 'rgba(0,0,0,0.8)',
fontFamily: Chart.defaults.global.defaultFontFamily,
fontSize: Chart.defaults.global.defaultFontSize,
fontStyle: 'bold',
fontColor: '#fff',
xPadding: 6,
yPadding: 6,
cornerRadius: 6,
position: 'center',
xAdjust: 0,
yAdjust: 0,
enabled: false,
content: null
};
Chart.Annotation.Element = require('./element.js')(Chart);
/* eslint-disable global-require */
Chart.Annotation.types = {
line: require('./types/line.js')(Chart),
box: require('./types/box.js')(Chart)
};
/* eslint-enable global-require */
var annotationPlugin = require('./annotation.js')(Chart);
module.exports = annotationPlugin;
Chart.pluginService.register(annotationPlugin);