|
|
@ -58,11 +58,13 @@ export function getTooltipOptions<T extends ChartType>({ |
|
|
callbacks: { |
|
|
callbacks: { |
|
|
label: (context) => { |
|
|
label: (context) => { |
|
|
let label = (context.dataset as ControllerDatasetOptions).label ?? ''; |
|
|
let label = (context.dataset as ControllerDatasetOptions).label ?? ''; |
|
|
|
|
|
|
|
|
if (label) { |
|
|
if (label) { |
|
|
label += ': '; |
|
|
label += ': '; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const yPoint = (context.parsed as Point).y; |
|
|
const yPoint = (context.parsed as Point).y; |
|
|
|
|
|
|
|
|
if (yPoint !== null) { |
|
|
if (yPoint !== null) { |
|
|
if (currency) { |
|
|
if (currency) { |
|
|
label += `${yPoint.toLocaleString(locale, { |
|
|
label += `${yPoint.toLocaleString(locale, { |
|
|
@ -75,10 +77,12 @@ export function getTooltipOptions<T extends ChartType>({ |
|
|
label += yPoint.toFixed(2); |
|
|
label += yPoint.toFixed(2); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return label; |
|
|
return label; |
|
|
}, |
|
|
}, |
|
|
title: (contexts) => { |
|
|
title: (contexts) => { |
|
|
const xPoint = (contexts[0].parsed as Point).x; |
|
|
const xPoint = (contexts[0].parsed as Point).x; |
|
|
|
|
|
|
|
|
if (groupBy && xPoint !== null) { |
|
|
if (groupBy && xPoint !== null) { |
|
|
return formatGroupedDate({ groupBy, date: xPoint }); |
|
|
return formatGroupedDate({ groupBy, date: xPoint }); |
|
|
} |
|
|
} |
|
|
@ -105,6 +109,7 @@ export function getTooltipPositionerMapTop( |
|
|
if (!position || !chart?.chartArea) { |
|
|
if (!position || !chart?.chartArea) { |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return { |
|
|
return { |
|
|
x: position.x, |
|
|
x: position.x, |
|
|
y: chart.chartArea.top |
|
|
y: chart.chartArea.top |
|
|
@ -132,6 +137,7 @@ export function getVerticalHoverLinePlugin<T extends 'line' | 'bar'>( |
|
|
const xValue = active[0].element.x; |
|
|
const xValue = active[0].element.x; |
|
|
|
|
|
|
|
|
const context = chartCanvas.nativeElement.getContext('2d'); |
|
|
const context = chartCanvas.nativeElement.getContext('2d'); |
|
|
|
|
|
|
|
|
if (context) { |
|
|
if (context) { |
|
|
context.lineWidth = width; |
|
|
context.lineWidth = width; |
|
|
context.strokeStyle = color; |
|
|
context.strokeStyle = color; |
|
|
|