import type { AlignValue, VerticalAlignValue } from '../../Core/Renderer/AlignObject'; import type ButtonThemeObject from '../../Core/Renderer/SVG/ButtonThemeObject'; import type ColorString from '../../Core/Color/ColorString'; import type CSSObject from '../../Core/Renderer/CSSObject'; import type DataGroupingOptions from '../../Extensions/DataGrouping/DataGroupingOptions'; import type { DeepPartial } from '../../Shared/Types'; import type Time from '../../Core/Time'; declare module '../../Core/Options' { interface LangOptions { /** * The text for the label for the "from" input box in the range * selector. Since v9.0, this string is empty as the label is not * rendered by default. * * @default "" * @product highstock gantt */ rangeSelectorFrom?: string; /** * The text for the label for the "to" input box in the range selector. * * @default → * @product highstock gantt */ rangeSelectorTo?: string; /** * The text for the label for the range selector buttons. * * @default Zoom * @product highstock gantt */ rangeSelectorZoom?: string; /** * The default text for the rangeselector buttons. * * @default {"allText":"All","allTitle":"View all","monthText":"{count}m","monthTitle":"View {count} {#eq count 1}month{else}months{/eq}","yearText":"{count}y","yearTitle":"View {count} {#eq count 1}year{else}years{/eq}","ytdText":"YTD","ytdTitle":"View year to date"} * @since 12.2.0 */ rangeSelector?: Partial>; } interface Options { /** * The range selector is a tool for selecting ranges to display within * the chart. It provides buttons to select preconfigured ranges in * the chart, like 1 day, 1 week, 1 month etc. It also provides input * boxes where min and max dates can be manually input. * * @product highstock gantt */ rangeSelector?: DeepPartial; } } /** * Event options for range selector buttons. * * @interface Highcharts.RangeSelectorButtonsEventsOptions */ export interface RangeSelectorButtonsEventsOptions { /** * Fires when clicking on the rangeSelector button. One parameter, * event, is passed to the function, containing common event * information. * * ```js * click: function(e) { * console.log(this); * } * ``` * * Return false to stop default button's click action. * * @sample {highstock} stock/rangeselector/button-click/ * Click event on the button * */ click?: RangeSelectorClickCallbackFunction; } /** * Configuration object for range selector buttons. * * @interface Highcharts.RangeSelectorButtonOptions */ export interface RangeSelectorButtonOptions { /** * How many units of the defined type the button should span. If `type` * is "month" and `count` is 3, the button spans three months. * * @default 1 */ count?: number; /** * A custom data grouping object for each button. * * @see [series.dataGrouping](#plotOptions.series.dataGrouping) * * @sample {highstock} stock/demo/rangeselector-datagrouping/ * Data grouping by range selector buttons * * @extends plotOptions.series.dataGrouping */ dataGrouping?: DataGroupingOptions; /** * Explanation for the button, shown as a tooltip on hover, and used by * assistive technology. * */ title?: string; events?: RangeSelectorButtonsEventsOptions; /** * Additional range (in milliseconds) added to the end of the calculated * time span. * * @sample {highstock} stock/rangeselector/min-max-offsets/ * Button offsets * * @default 0 * @since 6.0.0 */ offsetMax?: number; /** * Additional range (in milliseconds) added to the start of the * calculated time span. * * @sample {highstock} stock/rangeselector/min-max-offsets/ * Button offsets * * @default 0 * @since 6.0.0 */ offsetMin?: number; /** * When buttons apply dataGrouping on a series, by default zooming * in/out will deselect buttons and unset dataGrouping. Enable this * option to keep buttons selected when extremes change. * * @sample {highstock} stock/rangeselector/preserve-datagrouping/ * Different preserveDataGrouping settings * * @default false * @since 6.1.2 */ preserveDataGrouping?: boolean; /** * The text for the button itself. * */ text?: string; /** * Defined the time span for the button. Can be one of `millisecond`, * `second`, `minute`, `hour`, `day`, `week`, `month`, `year`, `ytd`, * and `all`. * */ type?: RangeSelectorButtonTypeValue; } /** * Possible values for the range selector button type. */ export type RangeSelectorButtonTypeValue = ('all' | 'day' | 'hour' | 'millisecond' | 'minute' | 'month' | 'second' | 'week' | 'year' | 'ytd'); /** * Language key format for range selector buttons. * * @typedef {string} Highcharts.RangeSelectorButtonLangKey */ export type RangeSelectorButtonLangKey = (`${RangeSelectorButtonTypeValue}Text` | `${RangeSelectorButtonTypeValue}Title`); /** * Callback function for range selector button click events. * * @callback Highcharts.RangeSelectorClickCallbackFunction * @param {Event} e * The click event * @return {boolean|undefined} * Return false to stop default button's click action */ export interface RangeSelectorClickCallbackFunction { (e: Event): (boolean | undefined); } export interface RangeSelectorOptions { /** * Whether to enable all buttons from the start. By default buttons are * only enabled if the corresponding time range exists on the X axis, * but enabling all buttons allows for dynamically loading different * time ranges. * * @sample {highstock} stock/rangeselector/allbuttonsenabled-true/ * All buttons enabled * * @default false * @since 2.0.3 */ allButtonsEnabled: boolean; /** * Positioning for the button row. * * @default {"align":"left","x":0,"y":0} * @since 1.2.4 */ buttonPosition: RangeSelectorPositionOptions; /** * An array of configuration objects for the buttons. * * Defaults to: * ```js * buttons: [{ * type: 'month', * count: 1, * text: '1m', * title: 'View 1 month' * }, { * type: 'month', * count: 3, * text: '3m', * title: 'View 3 months' * }, { * type: 'month', * count: 6, * text: '6m', * title: 'View 6 months' * }, { * type: 'ytd', * text: 'YTD', * title: 'View year to date' * }, { * type: 'year', * count: 1, * text: '1y', * title: 'View 1 year' * }, { * type: 'all', * text: 'All', * title: 'View all' * }] * ``` * * @sample {highstock} stock/demo/rangeselector-datagrouping/ * Data grouping by buttons * */ buttons: Array; /** * The space in pixels between the buttons in the range selector. * * @default 5 */ buttonSpacing: number; /** * A collection of attributes for the buttons. The object takes SVG * attributes like `fill`, `stroke`, `stroke-width`, as well as `style`, * a collection of CSS properties for the text. * * The object can also be extended with states, so you can set * presentational options for `hover`, `select` or `disabled` button * states. * * CSS styles for the text label. * * In styled mode, the buttons are styled by the * `.highcharts-range-selector-buttons .highcharts-button` rule with its * different states. * * @sample {highstock} stock/rangeselector/styling/ * Styling the buttons and inputs * */ buttonTheme: ButtonThemeObject; /** * Whether to collapse the range selector buttons into a dropdown when * there is not enough room to show everything in a single row, instead * of dividing the range selector into multiple rows. * Can be one of the following: * - `always`: Always collapse * - `responsive`: Only collapse when there is not enough room * - `never`: Never collapse * * @sample {highstock} stock/rangeselector/dropdown/ * Dropdown option * * @default "responsive" * @validvalue ["always", "responsive", "never"] * @since 9.0.0 */ dropdown: 'always' | 'never' | 'responsive'; /** * Enable or disable the range selector. Default to `true` for stock * charts, using the `stockChart` factory. * * @sample {highstock} stock/rangeselector/enabled/ * Disable the range selector * * @default {highstock} true */ enabled?: boolean; /** * When the rangeselector is floating, the plot area does not reserve * space for it. This opens for positioning anywhere on the chart. * * @sample {highstock} stock/rangeselector/floating/ * Placing the range selector between the plot area and the * navigator * * @default false * @since 6.0.0 */ floating: boolean; /** * Deprecated. The height of the range selector. Currently it is * calculated dynamically. * * @deprecated 6.0.0 * @since 2.1.9 */ height?: number; /** * The border color of the date input boxes. * * @sample {highstock} stock/rangeselector/styling/ * Styling the buttons and inputs * * @default 'none' * @since 1.3.7 */ inputBoxBorderColor: ColorString; /** * The pixel height of the date input boxes. * * @sample {highstock} stock/rangeselector/styling/ * Styling the buttons and inputs * * @default 17 * @since 1.3.7 */ inputBoxHeight: number; /** * The pixel width of the date input boxes. When `undefined`, the width * is fitted to the rendered content. * * @sample {highstock} stock/rangeselector/styling/ * Styling the buttons and inputs * * @since 1.3.7 */ inputBoxWidth?: number; /** * The date format in the input boxes when not selected for editing. * Defaults to `%e %b %Y`. * * This is used to determine which type of input to show, * `datetime-local`, `date` or `time` and falling back to `text` when * the browser does not support the input type or the format contains * milliseconds. * * @sample {highstock} stock/rangeselector/input-type/ * Input types * @sample {highstock} stock/rangeselector/input-format/ * Milliseconds in the range selector * * @default %e %b %Y */ inputDateFormat: Time.DateTimeFormat; /** * A custom callback function to parse values entered in the input boxes and * return a valid JavaScript time as milliseconds since 1970. The first * argument passed is the value to parse, second is a boolean indicating use * of UTC time. The third is a reference to the `time` object. Time zone can * be read from `time.timezone`. * * This will only get called for inputs of type `text`. Since v8.2.3, the * input type is dynamically determined based on the granularity of the * `inputDateFormat` and the browser support. * * @sample {highstock} stock/rangeselector/input-format/ * Milliseconds in the range selector * * @since 1.3.3 */ inputDateParser?: RangeSelectorParseCallbackFunction; /** * The date format in the input boxes when they are selected for * editing. This must be a format that is recognized by JavaScript * Date.parse. * * This will only be used for inputs of type `text`. Since v8.2.3, * the input type is dynamically determined based on the granularity * of the `inputDateFormat` and the browser support. * * @sample {highstock} stock/rangeselector/input-format/ * Milliseconds in the range selector * * @default %Y-%m-%d */ inputEditDateFormat: string; /** * Enable or disable the date input boxes. * * @default true */ inputEnabled: boolean; /** * Positioning for the input boxes. Allowed properties are `align`, * `x` and `y`. * * @default {"align":"right","x":0,"y":0} * @since 1.2.4 */ inputPosition: RangeSelectorPositionOptions; /** * The space in pixels between the labels and the date input boxes in * the range selector. * * @default 5 * @since 9.0.0 */ inputSpacing: number; /** * CSS for the HTML inputs in the range selector. * * In styled mode, the inputs are styled by the * `.highcharts-range-input text` rule in SVG mode, and * `input.highcharts-range-selector` when active. * * @sample {highstock} stock/rangeselector/styling/ * Styling the buttons and inputs * */ inputStyle: CSSObject; /** * CSS styles for the labels - the Zoom, From and To texts. * * In styled mode, the labels are styled by the * `.highcharts-range-label` class. * * @sample {highstock} stock/rangeselector/styling/ * Styling the buttons and inputs * */ labelStyle: CSSObject; /** * The index of the button to appear pre-selected. If the selected range * exceeds the total data range and the 'all' option is available, * the 'all' option, showing the full range, is automatically selected. * */ selected?: number; /** * The vertical alignment of the rangeselector box. Allowed properties * are `top`, `middle`, `bottom`. * * @sample {highstock} stock/rangeselector/vertical-align-middle/ * Middle * @sample {highstock} stock/rangeselector/vertical-align-bottom/ * Bottom * * @default 'top' * @since 6.0.0 */ verticalAlign: VerticalAlignValue; /** * The x offset of the range selector relative to its horizontal * alignment within `chart.spacingLeft` and `chart.spacingRight`. * * @default 0 * @since 6.0.0 */ x: number; /** * The y offset of the range selector relative to its horizontal * alignment within `chart.spacingLeft` and `chart.spacingRight`. * * @default 0 * @since 6.0.0 */ y: number; } /** * Custom callback function to parse values entered in the input boxes. * * @callback Highcharts.RangeSelectorParseCallbackFunction * @param {string} value * The value to parse * @param {boolean} useUTC * Whether to use UTC time * @param {Highcharts.Time} [time] * Reference to the time object * @return {number} * Valid JavaScript time as milliseconds since 1970 */ export interface RangeSelectorParseCallbackFunction { (value: string, useUTC: boolean, time?: Time): number; } /** * Positioning options for range selector elements. */ export interface RangeSelectorPositionOptions { /** * The alignment of the input box. Allowed properties are `left`, * `center`, `right`. * * @sample {highstock} stock/rangeselector/input-button-opposite-alignment/ * Opposite alignment * * @sample {highstock} stock/rangeselector/input-button-same-alignment/ * Same alignment for buttons and input * * @since 6.0.0 */ align: AlignValue; /** * X offset of the element. */ x: number; /** * Y offset of the element. */ y: number; } export default RangeSelectorOptions;