diff --git a/types/chart.js/chart.js-tests.ts b/types/chart.js/chart.js-tests.ts index 8d2190478f..1075865992 100644 --- a/types/chart.js/chart.js-tests.ts +++ b/types/chart.js/chart.js-tests.ts @@ -65,3 +65,23 @@ if (chart.chartArea) { console.log(chart.chartArea.bottom); console.log(chart.chartArea.left); } + +// http://www.chartjs.org/docs/latest/configuration/tooltip.html#position-modes +/** + * Custom positioner + * @function Chart.Tooltip.positioners.custom + * @param elements {Chart.Element[]} the tooltip elements + * @param eventPosition {Point} the position of the event in canvas coordinates + * @returns {Point} the tooltip position + */ +Chart.Tooltip.positioners.custom = function(elements: any, eventPosition: any) { + /** @type {Chart.Tooltip} */ + var tooltip = this; + + /* ... */ + + return { + x: 0, + y: 0 + }; +} \ No newline at end of file diff --git a/types/chart.js/index.d.ts b/types/chart.js/index.d.ts index db20617c2d..a2d22dbd67 100644 --- a/types/chart.js/index.d.ts +++ b/types/chart.js/index.d.ts @@ -44,6 +44,9 @@ declare class Chart { static controllers: { [key: string]: any; }; + + // Tooltip Static Options + static Tooltip: Chart.ChartTooltipsStaticConfiguartion; } declare class PluginServiceStatic { register(plugin: PluginServiceRegistrationOptions): void; @@ -275,6 +278,10 @@ declare namespace Chart { borderWidth?: number; } + interface ChartTooltipsStaticConfiguartion { + positioners: any; + } + interface ChartHoverOptions { mode?: string; animationDuration?: number;