]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Types: Move tooltip methods to model from plugin (#9729)
authorJukka Kurkela <jukka.kurkela@gmail.com>
Wed, 6 Oct 2021 12:53:27 +0000 (15:53 +0300)
committerGitHub <noreply@github.com>
Wed, 6 Oct 2021 12:53:27 +0000 (08:53 -0400)
types/index.esm.d.ts
types/tests/plugins/plugin.tooltip/chart.tooltip.ts

index f3824e4ba0a28dedcbfa45bed48ba13b3c17e3f9..848d824c15c162e8cf3e03fbc69702f5d0978858 100644 (file)
@@ -2427,15 +2427,15 @@ export interface TooltipModel<TType extends ChartType> {
 
   // tooltip options
   options: TooltipOptions<TType>;
+
+  getActiveElements(): ActiveElement[];
+  setActiveElements(active: ActiveDataPoint[], eventPosition: { x: number, y: number }): void;
 }
 
 export const Tooltip: Plugin & {
   readonly positioners: {
     [key: string]: (items: readonly ActiveElement[], eventPosition: { x: number; y: number }) => { x: number; y: number } | false;
   };
-
-  getActiveElements(): ActiveElement[];
-  setActiveElements(active: ActiveDataPoint[], eventPosition: { x: number, y: number }): void;
 };
 
 export interface TooltipCallbacks<
index 7aacb72dc49832b023ec4b37415e36bca0ddafac..66c824412d637cad5f819745882e03744120b66f 100644 (file)
@@ -11,3 +11,5 @@ const chart = new Chart('id', {
 });
 
 const tooltip = chart.tooltip;
+
+const active = tooltip && tooltip.getActiveElements();