From a80a25b7fbf2e52c39a4f60bd59690f97b7ecbdd Mon Sep 17 00:00:00 2001 From: richardison Date: Thu, 20 Sep 2018 11:29:15 -0400 Subject: [PATCH 1/2] Add: click event type to range selector button --- types/highcharts/highstock.d.ts | 8 +++++++- types/highcharts/test/highstock.ts | 8 ++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/types/highcharts/highstock.d.ts b/types/highcharts/highstock.d.ts index a97ae9effa..0c4fcce94e 100644 --- a/types/highcharts/highstock.d.ts +++ b/types/highcharts/highstock.d.ts @@ -2,7 +2,8 @@ // Project: http://www.highcharts.com/ // Definitions by: David Deutsch -// Definitions by: Dave Baumann +// Dave Baumann +// Richard Ison // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import * as Highcharts from "highcharts"; @@ -31,11 +32,16 @@ declare namespace Highstock { yAxis?: Highcharts.AxisOptions; } + interface RangeSelectButtonEvent { + click?(event: Event): void; + } + interface RangeSelectorButton { type: string; // Defines the timespan, can be one of 'millisecond', 'second', 'minute', 'day', 'week', 'month', 'ytd' (year to date), 'year' and 'all'. count?: number; text: string; dataGrouping?: any; // not sure how this works + events?: RangeSelectButtonEvent; } interface RangeSelectorOptions { diff --git a/types/highcharts/test/highstock.ts b/types/highcharts/test/highstock.ts index 2021e65b68..f1a464f491 100644 --- a/types/highcharts/test/highstock.ts +++ b/types/highcharts/test/highstock.ts @@ -25,6 +25,14 @@ $(() => { rangeSelector: { allButtonsEnabled: true, selected: 1, + buttons: [{ + type: 'month', + count: 1, + text: '1m', + events: { + click: () => { } + } + }], buttonTheme: { // styles for the buttons fill: 'none', stroke: 'none', From 5d9b665d4ca5358140b9d12980d65e1b64ba060d Mon Sep 17 00:00:00 2001 From: richardison Date: Thu, 20 Sep 2018 11:41:46 -0400 Subject: [PATCH 2/2] Update: interface name --- types/highcharts/highstock.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/highcharts/highstock.d.ts b/types/highcharts/highstock.d.ts index 0c4fcce94e..cc92bebe36 100644 --- a/types/highcharts/highstock.d.ts +++ b/types/highcharts/highstock.d.ts @@ -32,7 +32,7 @@ declare namespace Highstock { yAxis?: Highcharts.AxisOptions; } - interface RangeSelectButtonEvent { + interface RangeSelectorButtonEvent { click?(event: Event): void; } @@ -41,7 +41,7 @@ declare namespace Highstock { count?: number; text: string; dataGrouping?: any; // not sure how this works - events?: RangeSelectButtonEvent; + events?: RangeSelectorButtonEvent; } interface RangeSelectorOptions {