registerHotkey(hotkey)
registerHotkey registers a hot key globally.
Reference
typescript
(hotkey: {
name: string
keys: string | string[]
preventDefault?: boolean
stopPropagation?: boolean
check?: (params: {
chart: Chart
event: KeyboardEvent
key: string
hotkey: HotkeyTemplate
}) => boolean
action: (params: {
chart: Chart
event: KeyboardEvent
key: string
hotkey: HotkeyTemplate
}) => void
extendData?: any
}) => voidParameters
hotkeyHot key configuration.nameName, used as the global unique identifier. Registering the same name again overrides the existing configuration.keysKey combination, can be a string or a string array, such asR,Shift+Equal, or['Shift+=', 'Shift+NumpadAdd'].preventDefaultWhether to prevent the browser default behavior, default istrue.stopPropagationWhether to stop event propagation, default isfalse.checkCheck before execution. When it returnsfalse,actionwill not run.params.chartChart instance that triggered the hot key.params.eventOriginal keyboard event.params.keyNormalized key string.params.hotkeyCurrent hot key configuration.
actionMethod executed when the hot key is triggered. It receives the same params ascheck.extendDataCustom extension data.
Returns
registerHotkey returns undefined .