I'm very new to ChartJS (and JS in general) and couldn't find a fitting answer for my problem anywhere online.
I'm trying to customize the tooltips in my Bubblechart to fit format:
Dataset Label x.value: X y.value: X
For x and y values I'm fine. But I can't get the Headline I want.
For the Title I'm curently trying
tooltips: {
callbacks: {
title: function(tooltipItems, data) {
return data.datasets[tooltipItems[0].datasetIndex].label;
}
}
}
But this returns the entire array of all Labels for every Bubble. I guess this is due to how I populated the Labels.
data = {
labels: LabelArray,
datasets: [{
label: LabelArray,
data: chartData
}]};
I have labels under data and datasets because it didn't work with labels under datasets.
Any information on how to solve this is highly appreciated!
Sample Data of my Arrays:
chartData:
0: Object { x: "2786", y: "12.4", r: "15.32" }
1: Object { x: "4998", y: "23.7", r: "52.46" }
2: Object { x: "719", y: "20.4", r: "6.5" }
3: Object { x: "3649", y: "15.9", r: "25.73" }
LabelArray:
0: "A"
1: "B"
2: "C"
3: "D"
Best regards, David