From: Jukka Kurkela Date: Wed, 28 Jul 2021 11:57:55 +0000 (+0300) Subject: Types: Add `tooltip` to chart instance (#9490) X-Git-Tag: v3.5.1~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b4441417ae7ca60f29d029fe4db5d285574f6bad;p=thirdparty%2FChart.js.git Types: Add `tooltip` to chart instance (#9490) --- diff --git a/types/index.esm.d.ts b/types/index.esm.d.ts index fdb23250b..41095e03d 100644 --- a/types/index.esm.d.ts +++ b/types/index.esm.d.ts @@ -480,6 +480,8 @@ export declare class Chart< readonly scales: { [key: string]: Scale }; readonly attached: boolean; + readonly tooltip?: TooltipModel; // Only available if tooltip plugin is registered and enabled + data: ChartData; options: ChartOptions; diff --git a/types/tests/plugins/plugin.tooltip/chart.tooltip.ts b/types/tests/plugins/plugin.tooltip/chart.tooltip.ts new file mode 100644 index 000000000..7aacb72dc --- /dev/null +++ b/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;