]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Minor type fixes (#8719)
authorJosh Kelley <joshkel@gmail.com>
Thu, 25 Mar 2021 15:09:01 +0000 (11:09 -0400)
committerGitHub <noreply@github.com>
Thu, 25 Mar 2021 15:09:01 +0000 (11:09 -0400)
* Update RadialLinearScaleOptions.pointLabels.callback type

The code passes `index` as the second parameter, and one of the tests uses this.  `@default true` doesn't seem to make sense.

* Add types for additional documented parameters in tooltip callbacks

types/index.esm.d.ts

index 6f34f731dd8e70eeab76616ab61aa42421cd6408..3fb3ea3b7eb069bb2ed88b78dbc3066f27c75bfe 100644 (file)
@@ -2370,9 +2370,9 @@ export interface TooltipOptions<TType extends ChartType> extends CoreInteraction
   /**
    * Sort tooltip items.
    */
-  itemSort: (a: TooltipItem<ChartType>, b: TooltipItem<ChartType>) => number;
+  itemSort: (a: TooltipItem<ChartType>, b: TooltipItem<ChartType>, data: ChartData) => number;
 
-  filter: (e: TooltipItem<ChartType>) => boolean;
+  filter: (e: TooltipItem<ChartType>, index: number, array: TooltipItem<ChartType>[], data: ChartData) => boolean;
 
   /**
    * Background color of the tooltip.
@@ -3041,7 +3041,7 @@ export type RadialLinearScaleOptions = CoreScaleOptions & {
      * Padding of label backdrop.
      * @default 2
      */
-     backdropPadding: Scriptable<number | ChartArea, ScriptableScaleContext>;
+    backdropPadding: Scriptable<number | ChartArea, ScriptableScaleContext>;
 
     /**
      * if true, point labels are shown.
@@ -3060,9 +3060,8 @@ export type RadialLinearScaleOptions = CoreScaleOptions & {
 
     /**
      * Callback function to transform data labels to point labels. The default implementation simply returns the current string.
-     * @default true
      */
-    callback: (label: string) => string;
+    callback: (label: string, index: number) => string;
   };
 
   /**