API Reference
Namespaces
Classes
Events
Global
Externals

Class: Shortcuts

CIQ. Shortcuts


new Shortcuts(params)

Displays a legend of keyboard shortcuts and the actions the shortcuts perform.

Delegates display of the legend to the cq-floating-window web component by dispatching a "floatingWindow" event (see floatingWindowEventListener).

Creates the legend from keyboard shortcut specifications contained in a configuration object; for example, the default chart configuration object (see the Chart Configuration tutorial).

The keyboard shortcuts legend can be toggled using the Ctrl+Alt+K keystroke combination (see the shortcuts action in hotkeyConfig.hotkeys in js/defaultConfiguration.js).

Requires addOns.js.

Parameters:
Name Type Description
params object

The constructor parameters.

Properties
Name Type Argument Default Description
stx CIQ.ChartEngine

The chart engine instance for which the keyboard shortcuts legend is created.

config object

A configuration object that includes specifications for hot keys and drawing tool keyboard shortcuts. Typically, this object is the chart configuration object. See the Chart Configuration tutorial for the data format for keyboard shortcuts.

width number <optional>
"580"

The width of the floating window that contains the keyboard shortcuts legend.

windowForEachChart boolean <optional>
true

A flag that indicates whether each chart instance in a multi-chart document has its own keyboard shortcuts legend. If false, all charts share the same legend.

Since:
  • 8.2.0

Example
new CIQ.Shortcuts(
    stx: stxx,
    config: {
        drawingTools: [{ label: "line", shortcut: "l" }],
        hotkeyConfig: {
            hotkeys: [{ label: "Pan chart up", action: "up", commands: ["ArrowUp", "Up"] }]
        }
    }
);

Members


stx :CIQ.ChartEngine

The chart engine instance for which the keyboard shortcuts legend is created.

Type:
Since:
  • 8.2.0


width :number

Width of the floating window that contains the keyboard shortcuts legend.

Type:
  • number
Since:
  • 8.2.0


windowForEachChart :boolean

In a multi-chart document, indicates whether each chart has its own keyboard shortcuts legend. If false, all charts share the same legend.

Type:
  • boolean
Since:
  • 8.2.0

Methods


enableUI(stx)

Enables the keyboard shortcuts legend user interface.

Adds a showShortCuts function to the CIQ.UI.Layout helper. The showShortCuts function calls this class's toggle function to show and hide the keyboard shortcuts legend. Call showShortCuts in your application's user interface (see example).

This function is called when the add-on is instantiated.

Parameters:
Name Type Description
stx CIQ.ChartEngine

The chart engine that provides the UI context for the keyboard shortcuts legend.

Since:
  • 8.2.0

Example

Create a button that shows and hides the keyboard shortcuts legend.

<div class="ciq-footer full-screen-hide">
    <div class="shortcuts-ui ciq-shortcut-button"
         stxtap="Layout.showShortcuts()"
         title="Toggle shortcut legend">
    </div>
</div>

ensureMessagingAvailable(stx)

Ensures that an instance of the cq-floating-window web component is available to handle event messaging and create the shortcuts legend floating window.

This function is called when the add-on is instantiated.

Parameters:
Name Type Description
stx CIQ.ChartEngine

The chart engine that provides the UI context, which contains the cq-floating-window web component.

Since:
  • 8.2.0


getShortcutContent(config)

Creates the contents of the keyboard shortcuts legend based on specifications contained in a configuration object. The contents are displayed in a cq-floating-window web component.

This function is called when the add-on is instantiated.

Parameters:
Name Type Description
config object

A configuration object that includes specifications for drawing tool keyboard shortcuts and hot keys. Typically, this object is the chart configuration object (see the Chart Configuration tutorial).

Since:
  • 8.2.0

Returns:

The keyboard shortcuts legend as HTML.

Type
string

toggle( [value] [, node])

Opens and closes the floating window that contains the keyboard shortcuts legend.

Parameters:
Name Type Argument Description
value boolean <optional>

If true, the window is opened. If false, the window is closed. If not provided, the window state is toggled. That is, the window is opened if it is currently closed; closed, if it is currently open.

node HTMLElement <optional>

Optional node which triggered the toggle.

Since:
  • 9.1.0 Added node parameter.