Skip to content

Commit

Permalink
Fix tooltip align & external types (#8782)
Browse files Browse the repository at this point in the history
  • Loading branch information
etimberg committed Apr 2, 2021
1 parent c9eec31 commit 877f4c6
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions types/index.esm.d.ts
Expand Up @@ -2208,15 +2208,16 @@ export interface TitleOptions {
text: string | string[];
}

export type TooltipAlignment = 'start' | 'center' | 'end';
export type TooltipXAlignment = 'left' | 'center' | 'right';
export type TooltipYAlignment = 'top' | 'center' | 'bottom';

export interface TooltipModel<TType extends ChartType> {
// The items that we are rendering in the tooltip. See Tooltip Item Interface section
dataPoints: TooltipItem<TType>[];

// Positioning
xAlign: TooltipAlignment;
yAlign: TooltipAlignment;
xAlign: TooltipXAlignment;
yAlign: TooltipYAlignment;

// X and Y properties are the top left of the tooltip
x: number;
Expand Down Expand Up @@ -2331,9 +2332,9 @@ export interface TooltipOptions<TType extends ChartType> extends CoreInteraction
*/
enabled: Scriptable<boolean, ScriptableTooltipContext<TType>>;
/**
* See custom tooltip section.
* See external tooltip section.
*/
custom(this: TooltipModel<TType>, args: { chart: Chart; tooltip: TooltipModel<TType> }): void;
external(this: TooltipModel<TType>, args: { chart: Chart; tooltip: TooltipModel<TType> }): void;
/**
* The mode for positioning the tooltip
*/
Expand All @@ -2342,8 +2343,8 @@ export interface TooltipOptions<TType extends ChartType> extends CoreInteraction
/**
* Override the tooltip alignment calculations
*/
xAlign: Scriptable<TooltipAlignment, ScriptableTooltipContext<TType>>;
yAlign: Scriptable<TooltipAlignment, ScriptableTooltipContext<TType>>;
xAlign: Scriptable<TooltipXAlignment, ScriptableTooltipContext<TType>>;
yAlign: Scriptable<TooltipYAlignment, ScriptableTooltipContext<TType>>;

/**
* Sort tooltip items.
Expand Down

0 comments on commit 877f4c6

Please sign in to comment.