metrics: tooltip label

This commit is contained in:
Girish Ramakrishnan
2025-07-04 13:18:23 +02:00
parent 8bf9d38711
commit 0d28292cfb
4 changed files with 9 additions and 3 deletions

View File

@@ -45,7 +45,10 @@ function createGraphOptions({ yscale, period, displayLegend }) {
tooltip: {
callbacks: {
title: (tooltipItem) => moment(tooltipItem[0].raw.x).format(period.tooltipFormat),
label: (tooltipItem) => yscale.ticks.callback(tooltipItem.raw.y)
label: (tooltipItem) => {
const datasetLabel = tooltipItem.chart.data.datasets[tooltipItem.datasetIndex].label;
return `${datasetLabel}: ${yscale.ticks.callback(tooltipItem.raw.y)}`;
}
}
}
},