1
1
/* eslint-disable object-shorthand */
2
- /* global Chart, coreui, getStyle, hexToRgba */
2
+ /* global Chart, coreui, coreui.Utils. getStyle, coreui.Utils. hexToRgba */
3
3
4
4
/**
5
5
* --------------------------------------------------------------------------
6
- * CoreUI Free Boostrap Admin Template (v3.0.0-alpha.1 ): main.js
6
+ * CoreUI Boostrap Admin Template (v3.0.0): main.js
7
7
* Licensed under MIT (https://coreui.io/license)
8
8
* --------------------------------------------------------------------------
9
9
*/
@@ -14,18 +14,19 @@ Chart.defaults.global.pointHitDetectionRadius = 1
14
14
Chart . defaults . global . tooltips . enabled = false
15
15
Chart . defaults . global . tooltips . mode = 'index'
16
16
Chart . defaults . global . tooltips . position = 'nearest'
17
- Chart . defaults . global . tooltips . custom = coreui . ChartJS . CustomTooltips
17
+ Chart . defaults . global . tooltips . custom = coreui . ChartJS . customTooltips
18
18
Chart . defaults . global . defaultFontColor = '#646470'
19
+ Chart . defaults . global . responsiveAnimationDuration = 1
19
20
20
21
document . body . addEventListener ( 'classtoggle' , event => {
21
22
if ( event . detail . className === 'c-dark-theme' ) {
22
23
if ( document . body . classList . contains ( 'c-dark-theme' ) ) {
23
- cardChart1 . data . datasets [ 0 ] . pointBackgroundColor = getStyle ( '--primary-dark-theme' )
24
- cardChart2 . data . datasets [ 0 ] . pointBackgroundColor = getStyle ( '--info-dark-theme' )
24
+ cardChart1 . data . datasets [ 0 ] . pointBackgroundColor = coreui . Utils . getStyle ( '--primary-dark-theme' )
25
+ cardChart2 . data . datasets [ 0 ] . pointBackgroundColor = coreui . Utils . getStyle ( '--info-dark-theme' )
25
26
Chart . defaults . global . defaultFontColor = '#fff'
26
27
} else {
27
- cardChart1 . data . datasets [ 0 ] . pointBackgroundColor = getStyle ( '--primary' )
28
- cardChart2 . data . datasets [ 0 ] . pointBackgroundColor = getStyle ( '--info' )
28
+ cardChart1 . data . datasets [ 0 ] . pointBackgroundColor = coreui . Utils . getStyle ( '--primary' )
29
+ cardChart2 . data . datasets [ 0 ] . pointBackgroundColor = coreui . Utils . getStyle ( '--info' )
29
30
Chart . defaults . global . defaultFontColor = '#646470'
30
31
}
31
32
@@ -45,7 +46,7 @@ const cardChart1 = new Chart(document.getElementById('card-chart1'), {
45
46
label : 'My First dataset' ,
46
47
backgroundColor : 'transparent' ,
47
48
borderColor : 'rgba(255,255,255,.55)' ,
48
- pointBackgroundColor : getStyle ( '--primary' ) ,
49
+ pointBackgroundColor : coreui . Utils . getStyle ( '--primary' ) ,
49
50
data : [ 65 , 59 , 84 , 84 , 51 , 55 , 40 ]
50
51
}
51
52
]
@@ -98,7 +99,7 @@ const cardChart2 = new Chart(document.getElementById('card-chart2'), {
98
99
label : 'My First dataset' ,
99
100
backgroundColor : 'transparent' ,
100
101
borderColor : 'rgba(255,255,255,.55)' ,
101
- pointBackgroundColor : getStyle ( '--info' ) ,
102
+ pointBackgroundColor : coreui . Utils . getStyle ( '--info' ) ,
102
103
data : [ 1 , 18 , 9 , 17 , 34 , 22 , 11 ]
103
104
}
104
105
]
@@ -192,7 +193,8 @@ const cardChart4 = new Chart(document.getElementById('card-chart4'), {
192
193
label : 'My First dataset' ,
193
194
backgroundColor : 'rgba(255,255,255,.2)' ,
194
195
borderColor : 'rgba(255,255,255,.55)' ,
195
- data : [ 78 , 81 , 80 , 45 , 34 , 12 , 40 , 85 , 65 , 23 , 12 , 98 , 34 , 84 , 67 , 82 ]
196
+ data : [ 78 , 81 , 80 , 45 , 34 , 12 , 40 , 85 , 65 , 23 , 12 , 98 , 34 , 84 , 67 , 82 ] ,
197
+ barPercentage : 0.6
196
198
}
197
199
]
198
200
} ,
@@ -203,8 +205,7 @@ const cardChart4 = new Chart(document.getElementById('card-chart4'), {
203
205
} ,
204
206
scales : {
205
207
xAxes : [ {
206
- display : false ,
207
- barPercentage : 0.6
208
+ display : false
208
209
} ] ,
209
210
yAxes : [ {
210
211
display : false
@@ -221,24 +222,24 @@ const mainChart = new Chart(document.getElementById('main-chart'), {
221
222
datasets : [
222
223
{
223
224
label : 'My First dataset' ,
224
- backgroundColor : hexToRgba ( getStyle ( '--info' ) , 10 ) ,
225
- borderColor : getStyle ( '--info' ) ,
225
+ backgroundColor : coreui . Utils . hexToRgba ( coreui . Utils . getStyle ( '--info' ) , 10 ) ,
226
+ borderColor : coreui . Utils . getStyle ( '--info' ) ,
226
227
pointHoverBackgroundColor : '#fff' ,
227
228
borderWidth : 2 ,
228
229
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 ]
229
230
} ,
230
231
{
231
232
label : 'My Second dataset' ,
232
233
backgroundColor : 'transparent' ,
233
- borderColor : getStyle ( '--success' ) ,
234
+ borderColor : coreui . Utils . getStyle ( '--success' ) ,
234
235
pointHoverBackgroundColor : '#fff' ,
235
236
borderWidth : 2 ,
236
237
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 ]
237
238
} ,
238
239
{
239
240
label : 'My Third dataset' ,
240
241
backgroundColor : 'transparent' ,
241
- borderColor : getStyle ( '--danger' ) ,
242
+ borderColor : coreui . Utils . getStyle ( '--danger' ) ,
242
243
pointHoverBackgroundColor : '#fff' ,
243
244
borderWidth : 1 ,
244
245
borderDash : [ 8 , 5 ] ,
@@ -276,80 +277,3 @@ const mainChart = new Chart(document.getElementById('main-chart'), {
276
277
}
277
278
}
278
279
} )
279
-
280
- const brandBoxChartLabels = [ 'January' , 'February' , 'March' , 'April' , 'May' , 'June' , 'July' ]
281
-
282
- const brandBoxChartOptions = {
283
- responsive : true ,
284
- maintainAspectRatio : false ,
285
- legend : {
286
- display : false
287
- } ,
288
- scales : {
289
- xAxes : [ {
290
- display :false
291
- } ] ,
292
- yAxes : [ {
293
- display :false
294
- } ]
295
- } ,
296
- elements : {
297
- point : {
298
- radius : 0 ,
299
- hitRadius : 10 ,
300
- hoverRadius : 4 ,
301
- hoverBorderWidth : 3
302
- }
303
- }
304
- }
305
-
306
- // eslint-disable-next-line no-unused-vars
307
- const brandBoxChart1 = new Chart ( document . getElementById ( 'social-box-chart-1' ) , {
308
- type : 'line' ,
309
- data : {
310
- labels : brandBoxChartLabels ,
311
- datasets : [ {
312
- label : 'My First dataset' ,
313
- backgroundColor : 'rgba(255,255,255,.1)' ,
314
- borderColor : 'rgba(255,255,255,.55)' ,
315
- pointHoverBackgroundColor : '#fff' ,
316
- borderWidth : 2 ,
317
- data : [ 65 , 59 , 84 , 84 , 51 , 55 , 40 ]
318
- } ]
319
- } ,
320
- options : brandBoxChartOptions
321
- } )
322
-
323
- // eslint-disable-next-line no-unused-vars
324
- const brandBoxChart2 = new Chart ( document . getElementById ( 'social-box-chart-2' ) , {
325
- type : 'line' ,
326
- data : {
327
- labels : brandBoxChartLabels ,
328
- datasets : [ {
329
- label : 'My First dataset' ,
330
- backgroundColor : 'rgba(255,255,255,.1)' ,
331
- borderColor : 'rgba(255,255,255,.55)' ,
332
- pointHoverBackgroundColor : '#fff' ,
333
- borderWidth : 2 ,
334
- data : [ 1 , 13 , 9 , 17 , 34 , 41 , 38 ]
335
- } ]
336
- } ,
337
- options : brandBoxChartOptions
338
- } )
339
-
340
- // eslint-disable-next-line no-unused-vars
341
- const brandBoxChart3 = new Chart ( document . getElementById ( 'social-box-chart-3' ) , {
342
- type : 'line' ,
343
- data : {
344
- labels : brandBoxChartLabels ,
345
- datasets : [ {
346
- label : 'My First dataset' ,
347
- backgroundColor : 'rgba(255,255,255,.1)' ,
348
- borderColor : 'rgba(255,255,255,.55)' ,
349
- pointHoverBackgroundColor : '#fff' ,
350
- borderWidth : 2 ,
351
- data : [ 78 , 81 , 80 , 45 , 34 , 12 , 40 ]
352
- } ]
353
- } ,
354
- options : brandBoxChartOptions
355
- } )
0 commit comments