Skip to content

Commit

Permalink
Types: Move tooltip methods to model from plugin (#9729)
Browse files Browse the repository at this point in the history
  • Loading branch information
kurkle committed Oct 6, 2021
1 parent 28de4b0 commit 7993fc9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions types/index.esm.d.ts
Expand Up @@ -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<
Expand Down
2 changes: 2 additions & 0 deletions types/tests/plugins/plugin.tooltip/chart.tooltip.ts
Expand Up @@ -11,3 +11,5 @@ const chart = new Chart('id', {
});

const tooltip = chart.tooltip;

const active = tooltip && tooltip.getActiveElements();

0 comments on commit 7993fc9

Please sign in to comment.