I am working on a developing a chart using Chart.js and I want to only display te y-axis value in the tool-tip. Currently it displays:
date name_of_line: measurement
ex. Jan 1, 2020, 8:00:00 AM 5th Percentile: 100 oz.
And this is what I want it to look like: 5th Percentile: 100 oz
Here is the code I have so far to format the y-axis tooltip:
callbacks: {
label: function(context) {
let label = context.dataset.label || '';
if (label) {
label += ': ';
}
if (context.parsed.y !== null) {
label += new Intl.NumberFormat('en-US').format(context.parsed.y);
label += ' oz';
}
return label;
}
}
I ended up figuring out how to get this to work.