我正在向图表中的每个项目添加其他元素
export const showAdditionalText: any = {
afterDraw: (chart, easing) => {
const ctx = chart.chart.ctx;
chart.data.datasets.forEach((dataset, i) => {
const meta = chart.getDatasetMeta(i);
meta.data.forEach((element, index) => {
console.log(meta);
if (meta.type === 'bubble') {
const fontSize = 10;
const fontStyle = 'normal';
const fontFamily = 'Helvetica Neue';
ctx.font = Chart.helpers.fontString(fontSize, fontStyle, fontFamily);
const dataString = dataset.data[index].projectNumber;
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
ctx.fillStyle = 'white';
const position = element.tooltipPosition();
ctx.fillText(dataString, position.x, position.y - (fontSize / 4));
}
});
});
}
如何更改此新文本的Z索引并将其隐藏在工具提示下?