- Since:
-
9.4.0
Members
-
chartX :number
-
X coordinate of cursor, relative to left side of chart.
Type:
- number
- Since:
-
9.4.0
-
chartY :number
-
Y coordinate of cursor, relative to top edge of chart.
Type:
- number
- Since:
-
9.4.0
-
currentPanel :string
-
Name of the panel over which the cursor is located.
Type:
- string
- Since:
-
9.4.0
-
isDown :boolean
-
True if the browser has an active "down" event.
Type:
- boolean
- Since:
-
9.4.0
-
isLongPress :boolean
-
True if the browser is in long press state (down > 700 ms).
Type:
- boolean
- Since:
-
9.4.0
-
isUp :boolean
-
True if the browser does not have an active "down" event.
Type:
- boolean
- Since:
-
9.4.0
-
overChartData :boolean
-
True if cursor is hovering over chart data area (not over axes).
Type:
- boolean
- Since:
-
9.4.0
-
overXAxis :boolean
-
True if cursor is over the x axis.
Type:
- boolean
- Since:
-
9.4.0
-
overYAxis :boolean
-
True if cursor is over the y axis.
Type:
- boolean
- Since:
-
9.4.0
-
tick :number
-
Tick (index to the dataSet) being hovered over.
Type:
- number
- Since:
-
9.4.0
Methods
-
addHandler(fn)
-
Adds a handler to the state instance. A handler is a function that will execute when the state changes.
Parameters:
Name Type Description fnfunction Handler function to be called when state changes. Function takes no parameters and does not return anything.
- Since:
-
9.4.0
Returns:
Unique handler id, to be used when removing.
- Type
- string
Example
Add a handler:
state.addHandler(() => { if (state.isLongPress) ... // do action if current state is reflecting a longpress in progress }); -
changeState()
-
Triggers a state change signal, regardless of whether anything actually happened to the state. All added handlers will then fire.
- Since:
-
10.1.0
Returns:
Date-based number.
- Type
- number
-
removeHandler(uid)
-
Removes a handler from the state instance.
Parameters:
Name Type Description uidstring handler id.
- Since:
-
9.4.0
Type Definitions
-
InteractionConfig
-
Enables the ability to interact with the chart. Possible interactions include scrolling and zooming, with keyboard, mouse, touch, or wheel (trackpad). Swiping, pinching, and tapping gestures are supported, as well as long-press. Certain modules depend on interaction and so they are classified as plugins. The interaction configuration specifies which plugins are to be loaded for the chart. Each of these plugins consumes the state of the interaction, for example, button state and cursor position. Keypresses used for interaction emit custom events that you can listen to. They propagate up the DOM tree, so you can add an event listener to the chart container to catch them. The event type is "chartiq".
Type:
- CommonModuleConfig.<Interaction>
- Since:
-
9.4.0
Properties:
Name Type Argument Default Description highlightsRadiusnumber <optional>
10 Number of pixels away from a highlightable element (such as an event) cursor needs to be before element is highlighted, 3x this value for touch device
longPressTimenumber <optional>
700 Milliseconds to wait after pressing down without pressing up, before a long-press is registered.
moveTolerancenumber <optional>
6 How many pixels cursor needs to move with touch/mouse press before it registers as a movement requested.
reverseWheelPanboolean <optional>
Set to true to allow chart to move in the same direction as the trackpad/wheel movement.
useBackingStoreboolean <optional>
true Take advantage of devicePixelRatio.
yTolerancenumber <optional>
100 How many pixels cursor needs to move up/down in the chart area with touch/mouse press before it registers as a y-axis scroll requested.
lockInPlaceboolean <optional>
Set to true to disallow any panning or zooming of the chart.
pluginsArray.<string> <optional>
List of plugins to load with interaction.
pointerEventsboolean <optional>
true Set to false to disable pointer events.
