问题
The goal is to adjust the caret tooltip to be positioned above my horizontal stacked bar graph. oddly it works by setting yAlign
to bottom
and not to top. However it does not place the tooltip in the middle of the bar and it throws a TS ERROR saying Object literal may only specify known properties, and 'yAlign' does not exist in type 'ChartTooltipOptions'.
Is there a correct way to do this besides setting the ts to ignore.
options: {
tooltips: {
yAlign: 'bottom',
displayColors: false,
callbacks: {
title: (tooltipItems, data) => {
return '';
},
label: (tooltipItem, data: any) => {
const datasetLabel = null;
// to only show value
return data.datasets[tooltipItem.datasetIndex].data[tooltipItem.index];
},
}
},
来源:https://stackoverflow.com/questions/65586632/how-can-i-position-tooltip-caret-above-and-middle-of-bar