From 9a2ef63a1e5fe4c1c7d3b75ea098402b88bc4977 Mon Sep 17 00:00:00 2001 From: Tyrone Dougherty Date: Tue, 7 Aug 2018 15:24:16 +1000 Subject: [PATCH 1/5] @types/highcharts - Add animation boolean parameter to the Chart#update method --- types/highcharts/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/highcharts/index.d.ts b/types/highcharts/index.d.ts index f24004fadb..afe1e51a98 100644 --- a/types/highcharts/index.d.ts +++ b/types/highcharts/index.d.ts @@ -6487,9 +6487,10 @@ declare namespace Highcharts { * @param [boolean] redraw Whether to redraw the chart. Defaults to true. * @param [boolean] oneToOne When true, the series, xAxis and yAxis collections will be updated one to one, and * items will be either added or removed to match the new updated options. Defaults to false. + * @param [boolean] animation Whether to apply animation, and optionally animation configuration. * @since 5.0.0 */ - update(options: Options, redraw?: boolean, oneToOne?: boolean): void; + update(options: Options, redraw?: boolean, oneToOne?: boolean, animation?: boolean): void; /** * This method is deprecated as of 2.0.1. Updating the chart position after a move operation is no longer necessary. * @since 1.2.5 From 2132a14ea96e61a3ef951d3dce3dad43e07d339c Mon Sep 17 00:00:00 2001 From: Tyrone Dougherty Date: Fri, 17 Aug 2018 11:11:59 +1000 Subject: [PATCH 2/5] @types/highcharts - add AnimationOptions type to ChartObject#update method signature and update tests accordingly --- types/highcharts/index.d.ts | 4 ++-- types/highcharts/test/index.ts | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/types/highcharts/index.d.ts b/types/highcharts/index.d.ts index afe1e51a98..2ec1d268d6 100644 --- a/types/highcharts/index.d.ts +++ b/types/highcharts/index.d.ts @@ -6487,10 +6487,10 @@ declare namespace Highcharts { * @param [boolean] redraw Whether to redraw the chart. Defaults to true. * @param [boolean] oneToOne When true, the series, xAxis and yAxis collections will be updated one to one, and * items will be either added or removed to match the new updated options. Defaults to false. - * @param [boolean] animation Whether to apply animation, and optionally animation configuration. + * @param [(boolean | AnimationOptions)] animation Whether to apply animation, and optionally animation configuration. * @since 5.0.0 */ - update(options: Options, redraw?: boolean, oneToOne?: boolean, animation?: boolean): void; + update(options: Options, redraw?: boolean, oneToOne?: boolean, animation?: boolean | AnimationOptions): void; /** * This method is deprecated as of 2.0.1. Updating the chart position after a move operation is no longer necessary. * @since 1.2.5 diff --git a/types/highcharts/test/index.ts b/types/highcharts/test/index.ts index 1d6e921461..963a53d9bb 100644 --- a/types/highcharts/test/index.ts +++ b/types/highcharts/test/index.ts @@ -2457,6 +2457,11 @@ function test_ChartObject() { chart.update( {}); chart.update( {}, true); chart.update( {}, true, true); + chart.update( {}, true, true, true); + chart.update( {}, true, true, { + delay: 500, + duration: 3000 + }); } function test_ElementObject() { From 628934f8e6f2f392726871e59550b3d25bfed667 Mon Sep 17 00:00:00 2001 From: Tyrone Dougherty Date: Fri, 17 Aug 2018 11:52:22 +1000 Subject: [PATCH 3/5] @types/highcharts - Define the AnimationOptions interface and update tests accordingly --- types/highcharts/index.d.ts | 20 ++++++++++++++++++++ types/highcharts/test/index.ts | 5 ++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/types/highcharts/index.d.ts b/types/highcharts/index.d.ts index 2ec1d268d6..fea56746da 100644 --- a/types/highcharts/index.d.ts +++ b/types/highcharts/index.d.ts @@ -474,6 +474,26 @@ declare namespace Highcharts { skipNullPoints?: boolean; } + interface AnimationOptions { + /** + * The animation duration in milliseconds. + */ + duration: number; + /** + * The name of an easing function as defined on the Math object. + */ + easing?: string; + /** + * A callback function to exectute when the animation finishes. + */ + complete?: () => void; + /** + * A callback function to execute on each step of each attribute or CSS property that's being animated. + * The first argument contains information about the animation and progress. + */ + step?: () => void; + } + interface AxisTitle { /** * Alignment of the title relative to the axis values. Possible values are 'low', 'middle' or 'high'. diff --git a/types/highcharts/test/index.ts b/types/highcharts/test/index.ts index 963a53d9bb..bafb4a7516 100644 --- a/types/highcharts/test/index.ts +++ b/types/highcharts/test/index.ts @@ -2458,9 +2458,8 @@ function test_ChartObject() { chart.update( {}, true); chart.update( {}, true, true); chart.update( {}, true, true, true); - chart.update( {}, true, true, { - delay: 500, - duration: 3000 + chart.update( {}, true, true, { + duration: 3000, }); } From 3e8de0faacdf61f0dccdc7b83edee2c51d83e79e Mon Sep 17 00:00:00 2001 From: Tyrone Dougherty Date: Fri, 17 Aug 2018 11:58:07 +1000 Subject: [PATCH 4/5] @types/highcharts - add missing time parameter (and its associated TimeOptions interface type) to the Options interface --- types/highcharts/index.d.ts | 44 +++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/types/highcharts/index.d.ts b/types/highcharts/index.d.ts index fea56746da..3d17b3b281 100644 --- a/types/highcharts/index.d.ts +++ b/types/highcharts/index.d.ts @@ -5712,6 +5712,46 @@ declare namespace Highcharts { y?: number | null; } + interface TimeOptions { + /** + * A custom Date class for advanced date handling. For example, JDate can be hooked in to handle Jalali dates. + * @default undefined + * @since 4.0.4 + */ + Date?: Date; + /** + * A callback to return the time zone offset for a given datetime. It takes the timestamp in terms of milliseconds since + * January 1 1970, and returns the timezone offset in minutes. This provides a hook for drawing time based charts in + * specific time zones using their local DST crossover dates, with the help of external libraries. + * @default undefined + * @since 4.1.0 + */ + getTimezoneOffset?: (timestamp: Date) => number; + /** + * Requires moment.js. If the timezone option is specified, it creates a default getTimezoneOffset function that looks + * up the specified timezone in moment.js. If moment.js is not included, this throws a Highcharts error in the console, + * but does not crash the chart. + * @default undefined + * @since 5.0.7 + */ + timezone?: string; + /** + * The timezone offset in minutes. Positive values are west, negative values are east of UTC, as in the ECMAScript + * getTimezoneOffset method. Use this to display UTC based data in a predefined time zone. + * @default 0 + * @since 3.0.8 + */ + timezoneOffset?: number; + /** + * Whether to use UTC time for axis scaling, tickmark placement and time display in Highcharts.dateFormat. + * Advantages of using UTC is that the time displays equally regardless of the user agent's time zone settings. + * Local time can be used when the data is loaded in real time or when correct Daylight Saving Time transitions are required. + * @default undefined + * @since 6.0.5 + */ + useUTC?: boolean; + } + interface TitleOptions { /** * The horizontal alignment of the title. Can be one of 'left', 'center' and 'right'. @@ -6138,6 +6178,10 @@ declare namespace Highcharts { * The chart's subtitle */ subtitle?: SubtitleOptions; + /** + * The chart's time options + */ + time?: TimeOptions; /** * The chart's main title. */ From c95ca69eacb01f86ff06ecd9c1999607cec44560 Mon Sep 17 00:00:00 2001 From: Tyrone Dougherty Date: Fri, 17 Aug 2018 13:40:07 +1000 Subject: [PATCH 5/5] Remove unnecessary whitespace --- types/highcharts/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/highcharts/index.d.ts b/types/highcharts/index.d.ts index 3d17b3b281..a71e07c925 100644 --- a/types/highcharts/index.d.ts +++ b/types/highcharts/index.d.ts @@ -5720,7 +5720,7 @@ declare namespace Highcharts { */ Date?: Date; /** - * A callback to return the time zone offset for a given datetime. It takes the timestamp in terms of milliseconds since + * A callback to return the time zone offset for a given datetime. It takes the timestamp in terms of milliseconds since * January 1 1970, and returns the timezone offset in minutes. This provides a hook for drawing time based charts in * specific time zones using their local DST crossover dates, with the help of external libraries. * @default undefined