I created a doughnut chart using Chart.js 2.5. The issue I’m having is with the tooltip. When I hover over the chart, a tooltip is displayed with a caret that always stays in the left or right side, like this:
I want to change the caret position so that it always show in the bottom. Is that possible?
Here is my chart code
var myChart = new Chart(ctx, {
type: 'doughnut',
data: {
labels: ['Jan', 'Feb', 'Mar'],
datasets: [{
label: 'dataset',
data: [30, 50, 20],
backgroundColor: [
'rgb(153, 102, 255)',
'rgb(255, 205, 86)',
'rgb(54, 162, 235)'
],
}],
}
})
Lot of ways to customize the tooltip. Here's a good example via CodePen.
https://codepen.io/mab213/pen/PZOXdE
You could set
yAlign
property tobottom
for tooltips in your chart options to display tooltip's caret always at the bottom position ...ᴅᴇᴍᴏ
You can do this by setting the
yAlign
tooltips configuration option to "bottom":JSFiddle Demo: https://jsfiddle.net/tksr7bn9/