10
10
11
11
/* eslint-disable no-magic-numbers */
12
12
// Disable the on-canvas tooltip
13
- Chart . defaults . global . pointHitDetectionRadius = 1
14
- Chart . defaults . global . tooltips . enabled = false
15
- Chart . defaults . global . tooltips . mode = 'index'
16
- Chart . defaults . global . tooltips . position = 'nearest'
17
- Chart . defaults . global . tooltips . custom = coreui . ChartJS . customTooltips
18
- Chart . defaults . global . defaultFontColor = '#646470'
13
+ Chart . defaults . pointHitDetectionRadius = 1
14
+ Chart . defaults . plugins . tooltip . enabled = false
15
+ Chart . defaults . plugins . tooltip . mode = 'index'
16
+ Chart . defaults . plugins . tooltip . position = 'nearest'
17
+ Chart . defaults . plugins . tooltip . external = coreui . ChartJS . customTooltips
18
+ Chart . defaults . defaultFontColor = '#646470'
19
19
20
20
// eslint-disable-next-line no-unused-vars
21
21
const cardChart1 = new Chart ( document . getElementById ( 'card-chart1' ) , {
@@ -33,33 +33,36 @@ const cardChart1 = new Chart(document.getElementById('card-chart1'), {
33
33
]
34
34
} ,
35
35
options : {
36
- maintainAspectRatio : false ,
37
- legend : {
38
- display : false
36
+ plugins : {
37
+ legend : {
38
+ display : false
39
+ }
39
40
} ,
41
+ maintainAspectRatio : false ,
40
42
scales : {
41
- xAxes : [ {
42
- gridLines : {
43
- color : 'transparent' ,
44
- zeroLineColor : 'transparent'
43
+ x : {
44
+ grid : {
45
+ display : false ,
46
+ drawBorder : false
45
47
} ,
46
48
ticks : {
47
- fontSize : 2 ,
48
- fontColor : 'transparent'
49
+ display : false
49
50
}
50
- } ] ,
51
- yAxes : [ {
51
+ } ,
52
+ y : {
52
53
display : false ,
54
+ grid : {
55
+ display : false
56
+ } ,
53
57
ticks : {
54
- display : false ,
55
- min : 35 ,
56
- max : 89
58
+ display : false
57
59
}
58
- } ]
60
+ }
59
61
} ,
60
62
elements : {
61
63
line : {
62
- borderWidth : 1
64
+ borderWidth : 1 ,
65
+ tension : 0.4
63
66
} ,
64
67
point : {
65
68
radius : 4 ,
@@ -86,33 +89,34 @@ const cardChart2 = new Chart(document.getElementById('card-chart2'), {
86
89
]
87
90
} ,
88
91
options : {
89
- maintainAspectRatio : false ,
90
- legend : {
91
- display : false
92
+ plugins : {
93
+ legend : {
94
+ display : false
95
+ }
92
96
} ,
97
+ maintainAspectRatio : false ,
93
98
scales : {
94
- xAxes : [ {
95
- gridLines : {
96
- color : 'transparent' ,
97
- zeroLineColor : 'transparent'
99
+ x : {
100
+ grid : {
101
+ display : false ,
102
+ drawBorder : false
98
103
} ,
99
104
ticks : {
100
- fontSize : 2 ,
101
- fontColor : 'transparent'
105
+ display : false
102
106
}
103
- } ] ,
104
- yAxes : [ {
107
+ } ,
108
+ y : {
105
109
display : false ,
110
+ grid : {
111
+ display : false
112
+ } ,
106
113
ticks : {
107
- display : false ,
108
- min : - 4 ,
109
- max : 39
114
+ display : false
110
115
}
111
- } ]
116
+ }
112
117
} ,
113
118
elements : {
114
119
line : {
115
- tension : 0.00001 ,
116
120
borderWidth : 1
117
121
} ,
118
122
point : {
@@ -134,26 +138,30 @@ const cardChart3 = new Chart(document.getElementById('card-chart3'), {
134
138
label : 'My First dataset' ,
135
139
backgroundColor : 'rgba(255,255,255,.2)' ,
136
140
borderColor : 'rgba(255,255,255,.55)' ,
137
- data : [ 78 , 81 , 80 , 45 , 34 , 12 , 40 ]
141
+ data : [ 78 , 81 , 80 , 45 , 34 , 12 , 40 ] ,
142
+ fill : true
138
143
}
139
144
]
140
145
} ,
141
146
options : {
142
- maintainAspectRatio : false ,
143
- legend : {
144
- display : false
147
+ plugins : {
148
+ legend : {
149
+ display : false
150
+ }
145
151
} ,
152
+ maintainAspectRatio : false ,
146
153
scales : {
147
- xAxes : [ {
154
+ x : {
148
155
display : false
149
- } ] ,
150
- yAxes : [ {
156
+ } ,
157
+ y : {
151
158
display : false
152
- } ]
159
+ }
153
160
} ,
154
161
elements : {
155
162
line : {
156
- borderWidth : 2
163
+ borderWidth : 2 ,
164
+ tension : 0.4
157
165
} ,
158
166
point : {
159
167
radius : 0 ,
@@ -181,16 +189,32 @@ const cardChart4 = new Chart(document.getElementById('card-chart4'), {
181
189
} ,
182
190
options : {
183
191
maintainAspectRatio : false ,
184
- legend : {
185
- display : false
192
+ plugins : {
193
+ legend : {
194
+ display : false
195
+ }
186
196
} ,
187
197
scales : {
188
- xAxes : [ {
189
- display : false
190
- } ] ,
191
- yAxes : [ {
192
- display : false
193
- } ]
198
+ x : {
199
+ grid : {
200
+ display : false ,
201
+ drawTicks : false
202
+
203
+ } ,
204
+ ticks : {
205
+ display : false
206
+ }
207
+ } ,
208
+ y : {
209
+ grid : {
210
+ display : false ,
211
+ drawBorder : false ,
212
+ drawTicks : false
213
+ } ,
214
+ ticks : {
215
+ display : false
216
+ }
217
+ }
194
218
}
195
219
}
196
220
} )
@@ -207,19 +231,18 @@ const mainChart = new Chart(document.getElementById('main-chart'), {
207
231
borderColor : coreui . Utils . getStyle ( '--cui-info' ) ,
208
232
pointHoverBackgroundColor : '#fff' ,
209
233
borderWidth : 2 ,
210
- data : [ 165 , 180 , 70 , 69 , 77 , 57 , 125 , 165 , 172 , 91 , 173 , 138 , 155 , 89 , 50 , 161 , 65 , 163 , 160 , 103 , 114 , 185 , 125 , 196 , 183 , 64 , 137 , 95 , 112 , 175 ]
234
+ data : [ 165 , 180 , 70 , 69 , 77 , 57 , 125 , 165 , 172 , 91 , 173 , 138 , 155 , 89 , 50 , 161 , 65 , 163 , 160 , 103 , 114 , 185 , 125 , 196 , 183 , 64 , 137 , 95 , 112 , 175 ] ,
235
+ fill : true
211
236
} ,
212
237
{
213
238
label : 'My Second dataset' ,
214
- backgroundColor : 'transparent' ,
215
239
borderColor : coreui . Utils . getStyle ( '--cui-success' ) ,
216
240
pointHoverBackgroundColor : '#fff' ,
217
241
borderWidth : 2 ,
218
242
data : [ 92 , 97 , 80 , 100 , 86 , 97 , 83 , 98 , 87 , 98 , 93 , 83 , 87 , 98 , 96 , 84 , 91 , 97 , 88 , 86 , 94 , 86 , 95 , 91 , 98 , 91 , 92 , 80 , 83 , 82 ]
219
243
} ,
220
244
{
221
245
label : 'My Third dataset' ,
222
- backgroundColor : 'transparent' ,
223
246
borderColor : coreui . Utils . getStyle ( '--cui-danger' ) ,
224
247
pointHoverBackgroundColor : '#fff' ,
225
248
borderWidth : 1 ,
@@ -230,25 +253,30 @@ const mainChart = new Chart(document.getElementById('main-chart'), {
230
253
} ,
231
254
options : {
232
255
maintainAspectRatio : false ,
233
- legend : {
234
- display : false
256
+ plugins : {
257
+ legend : {
258
+ display : false
259
+ }
235
260
} ,
236
261
scales : {
237
- xAxes : [ {
238
- gridLines : {
262
+ x : {
263
+ grid : {
239
264
drawOnChartArea : false
240
265
}
241
- } ] ,
242
- yAxes : [ {
266
+ } ,
267
+ y : {
243
268
ticks : {
244
269
beginAtZero : true ,
245
270
maxTicksLimit : 5 ,
246
271
stepSize : Math . ceil ( 250 / 5 ) ,
247
272
max : 250
248
273
}
249
- } ]
274
+ }
250
275
} ,
251
276
elements : {
277
+ line : {
278
+ tension : 0.4
279
+ } ,
252
280
point : {
253
281
radius : 0 ,
254
282
hitRadius : 10 ,
0 commit comments