]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Fix tooltip align & external types (#8782)
authorEvert Timberg <evert.timberg+github@gmail.com>
Fri, 2 Apr 2021 14:53:00 +0000 (10:53 -0400)
committerGitHub <noreply@github.com>
Fri, 2 Apr 2021 14:53:00 +0000 (10:53 -0400)
types/index.esm.d.ts

index 39cedbc4a4def2bb041c1bcf6912928471d5395d..64e9936b67bf27a41b490e4b52e7848c363d45c4 100644 (file)
@@ -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;
@@ -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
    */
@@ -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.