@highcharts/dashboards
Version:
Highcharts Dashboards framework
100 lines (99 loc) • 2.94 kB
TypeScript
import type Time from './Time';
import type Chart from './Chart/Chart';
/**
* Provide error messages for debugging, with links to online explanation. This
* function can be overridden to provide custom error handling.
*
* @sample highcharts/chart/highcharts-error/
* Custom error handler
*
* @function Highcharts.error
*
* @param {number|string} code
* The error code. See
* [errors.xml](https://github.com/highcharts/highcharts/blob/master/errors/errors.xml)
* for available codes. If it is a string, the error message is printed
* directly in the console.
*
* @param {boolean} [stop=false]
* Whether to throw an error or just log a warning in the console.
*
* @param {Highcharts.Chart} [chart]
* Reference to the chart that causes the error. Used in 'debugger'
* module to display errors directly on the chart.
* Important note: This argument is undefined for errors that lack
* access to the Chart instance. In such case, the error will be
* displayed on the last created chart.
*
* @param {Highcharts.Dictionary<string>} [params]
* Additional parameters for the generated message.
*
* @return {void}
*/
export declare function error(code: (number | string), stop?: boolean, chart?: Chart, params?: Record<string, string>): void;
export declare namespace error {
const messages: Array<string>;
}
/**
* The time unit lookup
*
* @ignore
*/
export declare const timeUnits: Record<Time.TimeUnit, number>;
/**
* Get a unique key for using in internal element id's and pointers. The key is
* composed of a random hash specific to this Highcharts instance, and a
* counter.
*
* @example
* let id = uniqueKey(); // => 'highcharts-x45f6hp-0'
*
* @function Highcharts.uniqueKey
*
* @return {string}
* A unique key.
*/
export declare const uniqueKey: () => string;
/**
* Activates a serial mode for element IDs provided by
* {@link Highcharts.uniqueKey}. This mode can be used in automated tests, where
* a simple comparison of two rendered SVG graphics is needed.
*
* **Note:** This is only for testing purposes and will break functionality in
* webpages with multiple charts.
*
* @example
* if (
* process &&
* process.env.NODE_ENV === 'development'
* ) {
* Highcharts.useSerialIds(true);
* }
*
* @function Highcharts.useSerialIds
*
* @param {boolean} [mode]
* Changes the state of serial mode.
*
* @return {boolean|undefined}
* State of the serial mode.
*/
export declare function useSerialIds(mode?: boolean): (boolean | undefined);
export interface ErrorMessageEventObject {
/**
* The chart that causes the error.
*/
chart?: Chart;
/**
* The error code.
*/
code: number;
/**
* The error message.
*/
message?: string;
/**
* Additional parameters for the generated message.
*/
params?: Record<string, string>;
}