Skip to content

Commit a309983

Browse files
committed
fix: custom tooltips does not show - closes #6
1 parent 654ee81 commit a309983

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

resources/js/coreui/main.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ Chart.defaults.global.pointHitDetectionRadius = 1
1414
Chart.defaults.global.tooltips.enabled = false
1515
Chart.defaults.global.tooltips.mode = 'index'
1616
Chart.defaults.global.tooltips.position = 'nearest'
17-
Chart.defaults.global.tooltips.custom = coreui.ChartJS.CustomTooltips
17+
Chart.defaults.global.tooltips.custom = coreui.ChartJS.customTooltips
1818
Chart.defaults.global.defaultFontColor = '#646470'
19+
Chart.defaults.global.responsiveAnimationDuration = 1
1920

2021
document.body.addEventListener('classtoggle', event => {
2122
if (event.detail.className === 'c-dark-theme') {
@@ -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
})

resources/js/coreui/widgets.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Chart.defaults.global.pointHitDetectionRadius = 1
1313
Chart.defaults.global.tooltips.enabled = false
1414
Chart.defaults.global.tooltips.mode = 'index'
1515
Chart.defaults.global.tooltips.position = 'nearest'
16-
Chart.defaults.global.tooltips.custom = coreui.ChartJS.CustomTooltips
16+
Chart.defaults.global.tooltips.custom = coreui.ChartJS.customTooltips
1717

1818
document.body.addEventListener('classtoggle', event => {
1919
if (event.detail.className === 'c-dark-theme') {

0 commit comments

Comments
 (0)