Skip to content

Commit

Permalink
Types: Add tooltip to chart instance (#9490)
Browse files Browse the repository at this point in the history
  • Loading branch information
kurkle committed Jul 28, 2021
1 parent 1c837a9 commit b444141
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions types/index.esm.d.ts
Expand Up @@ -480,6 +480,8 @@ export declare class Chart<
readonly scales: { [key: string]: Scale };
readonly attached: boolean;

readonly tooltip?: TooltipModel<TType>; // Only available if tooltip plugin is registered and enabled

data: ChartData<TType, TData, TLabel>;
options: ChartOptions<TType>;

Expand Down
13 changes: 13 additions & 0 deletions types/tests/plugins/plugin.tooltip/chart.tooltip.ts
@@ -0,0 +1,13 @@
import { Chart } from '../../../index.esm';

const chart = new Chart('id', {
type: 'line',
data: {
labels: [],
datasets: [{
data: []
}]
},
});

const tooltip = chart.tooltip;

0 comments on commit b444141

Please sign in to comment.