123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228 |
- /*!*
- *
- * Copyright (c) Highsoft AS. All rights reserved.
- *
- *!*/
- import * as globals from "../globals";
- import * as _Highcharts from "../highcharts";
- /**
- * Adds the module to the imported Highcharts namespace.
- *
- * @param highcharts
- * The imported Highcharts namespace to extend.
- */
- export function factory(highcharts: typeof Highcharts): void;
- declare module "../highcharts" {
- interface Chart {
- /**
- * Apply context to a format string from lang options of the chart.
- *
- * @param langKey
- * Key (using dot notation) into lang option structure.
- *
- * @param context
- * Context to apply to the format string.
- *
- * @return The formatted string.
- */
- langFormat(langKey: string, context: Dictionary<any>): string;
- }
- /**
- * Options for the keyboard navigation handler.
- */
- interface KeyboardNavigationHandlerOptionsObject {
- /**
- * Function to run on initialization of module.
- */
- init: Function;
- /**
- * An array containing pairs of an array of keycodes, mapped to a
- * handler function. When the keycode is received, the handler is called
- * with the keycode as parameter.
- */
- keyCodeMap: Array<[Array<number>, Function]>;
- /**
- * Function to run before moving to next/prev module. Receives moving
- * direction as parameter: +1 for next, -1 for previous.
- */
- terminate?: Function;
- /**
- * Function to run to validate module. Should return false if module
- * should not run, true otherwise. Receives chart as parameter.
- */
- validate?: Function;
- }
- interface PointAccessibilityOptionsObject {
- /**
- * Provide a description of the data point, announced to screen readers.
- */
- description?: string;
- /**
- * Enable or disable exposing the point to assistive technology
- */
- enabled?: boolean;
- }
- interface PointOptionsObject {
- accessibility?: PointAccessibilityOptionsObject;
- }
- /**
- * The AccessibilityComponent base class, representing a part of the chart
- * that has accessibility logic connected to it. This class can be inherited
- * from to create a custom accessibility component for a chart.
- *
- * Components should take care to destroy added elements and unregister
- * event handlers on destroy. This is handled automatically if using
- * this.addEvent and this.createElement.
- */
- class AccessibilityComponent {
- /**
- * Called when accessibility is disabled or chart is destroyed.
- */
- static destroy(): void;
- /**
- * Get keyboard navigation handler for this component.
- */
- static getKeyboardNavigation(): KeyboardNavigationHandler;
- /**
- * Called on component initialization.
- */
- static init(): void;
- /**
- * Called on every chart render.
- */
- static onChartRender(): void;
- /**
- * Called on updates to the chart, including options changes. Note that
- * this is also called on first render of chart.
- */
- static onChartUpdate(): void;
- }
- /**
- * Define a keyboard navigation handler for use with a
- * Highcharts.AccessibilityComponent instance. This functions as an
- * abstraction layer for keyboard navigation, and defines a map of keyCodes
- * to handler functions.
- */
- class KeyboardNavigationHandler {
- /**
- * Define a keyboard navigation handler for use with a
- * Highcharts.AccessibilityComponent instance. This functions as an
- * abstraction layer for keyboard navigation, and defines a map of
- * keyCodes to handler functions.
- *
- * @param chart
- * The chart this module should act on.
- *
- * @param options
- * Options for the keyboard navigation handler.
- */
- constructor(chart: Chart, options: KeyboardNavigationHandlerOptionsObject);
- }
- /**
- * i18n formatting function. Extends Highcharts.format() functionality by
- * also handling arrays and plural conditionals. Arrays can be indexed as
- * follows:
- *
- * - Format: 'This is the first index: {myArray[0]}. The last:
- * {myArray[-1]}.'
- *
- * - Context: { myArray: [0, 1, 2, 3, 4, 5] }
- *
- * - Result: 'This is the first index: 0. The last: 5.'
- *
- * They can also be iterated using the #each() function. This will repeat
- * the contents of the bracket expression for each element. Example:
- *
- * - Format: 'List contains: {#each(myArray)cm }'
- *
- * - Context: { myArray: [0, 1, 2] }
- *
- * - Result: 'List contains: 0cm 1cm 2cm '
- *
- * The #each() function optionally takes a length parameter. If positive,
- * this parameter specifies the max number of elements to iterate through.
- * If negative, the function will subtract the number from the length of the
- * array. Use this to stop iterating before the array ends. Example:
- *
- * - Format: 'List contains: {#each(myArray, -1) }and {myArray[-1]}.'
- *
- * - Context: { myArray: [0, 1, 2, 3] }
- *
- * - Result: 'List contains: 0, 1, 2, and 3.'
- *
- * Use the #plural() function to pick a string depending on whether or not a
- * context object is 1. Arguments are #plural(obj, plural, singular).
- * Example:
- *
- * - Format: 'Has {numPoints} {#plural(numPoints, points, point}.'
- *
- * - Context: { numPoints: 5 }
- *
- * - Result: 'Has 5 points.'
- *
- * Optionally there are additional parameters for dual and none:
- * #plural(obj, plural, singular, dual, none). Example:
- *
- * - Format: 'Has {#plural(numPoints, many points, one point, two points,
- * none}.'
- *
- * - Context: { numPoints: 2 }
- *
- * - Result: 'Has two points.'
- *
- * The dual or none parameters will take precedence if they are supplied.
- *
- * @param formatString
- * The string to format.
- *
- * @param context
- * Context to apply to the format string.
- *
- * @param chart
- * A `Chart` instance with a time object and numberFormatter, passed
- * on to format().
- *
- * @return The formatted string.
- */
- function i18nFormat(formatString: string, context: Dictionary<any>, chart: Chart): string;
- /**
- * If we have a clear root option node for old and new options and a mapping
- * between, we can use this generic function for the copy and warn logic.
- */
- function deprecateFromOptionsMap(): void;
- /**
- * Put accessible info on series and points of a series.
- *
- * @param series
- * The series to add info on.
- */
- function describeSeries(series: Series): void;
- /**
- * Return string with the axis name/title.
- */
- function getAxisDescription(axis: Axis): string;
- /**
- * Describe an axis from-to range.
- */
- function getAxisFromToDescription(axis: Axis): string;
- /**
- * Return string with text description of the axis range.
- *
- * @param axis
- * The axis to get range desc of.
- *
- * @return A string with the range description for the axis.
- */
- function getAxisRangeDescription(axis: Axis): string;
- /**
- * Describe the length of the time window shown on an axis.
- */
- function getAxisTimeLengthDesc(axis: Axis): string;
- /**
- * Describe the range of a category axis.
- */
- function getCategoryAxisRangeDesc(axis: Axis): string;
- function getChartTitle(): string;
- }
- export default factory;
- export let Highcharts: typeof _Highcharts;
|