/
label.js
93 lines (93 loc) · 2.38 KB
/
label.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
module.exports = {
tolerance: 0.0075,
config: {
type: 'bar',
options: {
scales: {
x: {
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
},
y: {
display: false,
min: 0,
max: 25
}
},
plugins: {
annotation: {
annotations: {
box1: {
type: 'box',
xMin: 1.5,
xMax: 3.5,
yMin: 5,
yMax: 10,
backgroundColor: 'rgba(255, 99, 132, 0.5)',
borderColor: 'rgba(255, 99, 132)',
borderDash: [6, 6],
borderWidth: 5,
label: {
enabled: true,
content: 'This is a label',
}
},
box2: {
type: 'box',
xMin: 'May',
xMax: 'July',
yMin: 11,
yMax: 15,
backgroundColor: 'rgba(255, 99, 132, 0.5)',
borderColor: 'black',
borderWidth: 15,
label: {
enabled: true,
borderColor: 'green',
content: 'This label tests clipping',
position: 'start'
}
},
box3: {
type: 'box',
xMin: -0.5,
xMax: 'May',
yMin: 16,
yMax: 20,
backgroundColor: 'rgba(255, 99, 132, 0.5)',
borderColor: 'rgba(255, 99, 132)',
borderDash: [6, 6],
borderWidth: 5,
label: {
enabled: true,
content: 'This is a label with different length',
position: 'end'
}
},
box4: {
type: 'box',
xMin: 'June',
xMax: 'July',
yMin: 5,
yMax: 9,
backgroundColor: 'rgba(255, 99, 132, 0.5)',
borderColor: 'rgba(255, 99, 132)',
borderDash: [6, 6],
borderWidth: 5,
label: {
enabled: true,
content: 'This is the label',
color: 'red',
position: {
x: 'start'
}
}
}
}
}
}
}
},
options: {
spriteText: true
}
};