mirror of https://github.com/ghostfolio/ghostfolio
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
761 B
29 lines
761 B
import { getTooltipPositionerMapTop } from '@ghostfolio/common/chart-helper';
|
|
|
|
import { Tooltip, TooltipPositionerFunction, ChartType } from 'chart.js';
|
|
|
|
interface VerticalHoverLinePluginOptions {
|
|
color?: string;
|
|
width?: number;
|
|
}
|
|
|
|
declare module 'chart.js' {
|
|
interface PluginOptionsByType<TType extends ChartType> {
|
|
verticalHoverLine: TType extends 'line' | 'bar'
|
|
? VerticalHoverLinePluginOptions
|
|
: never;
|
|
}
|
|
interface TooltipPositionerMap {
|
|
top: TooltipPositionerFunction<ChartType>;
|
|
}
|
|
}
|
|
|
|
export function registerChartConfiguration() {
|
|
if (Tooltip.positioners['top']) {
|
|
return;
|
|
}
|
|
|
|
Tooltip.positioners.top = function (_elements, eventPosition) {
|
|
return getTooltipPositionerMapTop(this.chart, eventPosition);
|
|
};
|
|
}
|
|
|