@@ -14,8 +14,9 @@ Chart.defaults.global.pointHitDetectionRadius = 1
1414Chart . defaults . global . tooltips . enabled = false
1515Chart . defaults . global . tooltips . mode = 'index'
1616Chart . defaults . global . tooltips . position = 'nearest'
17- Chart . defaults . global . tooltips . custom = coreui . ChartJS . CustomTooltips
17+ Chart . defaults . global . tooltips . custom = coreui . ChartJS . customTooltips
1818Chart . defaults . global . defaultFontColor = '#646470'
19+ Chart . defaults . global . responsiveAnimationDuration = 1
1920
2021document . body . addEventListener ( 'classtoggle' , event => {
2122 if ( event . detail . className === 'c-dark-theme' ) {
@@ -192,9 +193,10 @@ const cardChart4 = new Chart(document.getElementById('card-chart4'), {
192193 label : 'My First dataset' ,
193194 backgroundColor : 'rgba(255,255,255,.2)' ,
194195 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.7
196198 }
197- ]
199+ ] ,
198200 } ,
199201 options : {
200202 maintainAspectRatio : false ,
@@ -203,8 +205,7 @@ const cardChart4 = new Chart(document.getElementById('card-chart4'), {
203205 } ,
204206 scales : {
205207 xAxes : [ {
206- display : false ,
207- barPercentage : 0.6
208+ display : false
208209 } ] ,
209210 yAxes : [ {
210211 display : false
@@ -273,6 +274,14 @@ const mainChart = new Chart(document.getElementById('main-chart'), {
273274 hoverRadius : 4 ,
274275 hoverBorderWidth : 3
275276 }
277+ } ,
278+ tooltips : {
279+ intersect : true ,
280+ callbacks : {
281+ labelColor : function ( tooltipItem , chart ) {
282+ return { backgroundColor : chart . data . datasets [ tooltipItem . datasetIndex ] . borderColor } ;
283+ }
284+ }
276285 }
277286 }
278287} )
0 commit comments