fix(chart.js): add missing ChartTooltipItem fields (#36611)

This commit is contained in:
Christian
2019-07-03 08:45:06 -07:00
committed by Ryan Cavanaugh
parent 0adb4909e9
commit ac1869e78d
2 changed files with 12 additions and 1 deletions
+8 -1
View File
@@ -46,7 +46,14 @@ const chart: Chart = new Chart(ctx, {
caretPadding: 2,
displayColors: true,
borderColor: "rgba(0,0,0,0)",
borderWidth: 1
borderWidth: 1,
callbacks: {
title: ([point]) => point.label ? point.label.substring(0, 2) : 'title',
label(tooltipItem) {
const { value, x, y, label } = tooltipItem;
return `${label}(${x}, ${y}) = ${value}`;
},
},
},
scales: {
xAxes: [
+4
View File
@@ -154,10 +154,14 @@ declare namespace Chart {
}
interface ChartTooltipItem {
label?: string;
value?: string;
xLabel?: string | number;
yLabel?: string | number;
datasetIndex?: number;
index?: number;
x?: number;
y?: number;
}
interface ChartTooltipLabelColor {