new Marker(params)
A marker is a DOM object that is managed by the chart.
Makers are placed in containers which are div elements whose placement and size correspond with a panel on the
chart. A container exists for each panel.
A marker's primary purpose is to provide additional information for a data point on the chart. As such, markers can be placed by date, tick, or bar to control their position on the x-axis, and by value (price) to control their position on the y-axis. Additional default positioning is also available, including the ability to create custom positioning logic. Once the positioning logic is established for markers, they are repositioned as needed when the user scrolls or zooms the chart.
Alternatively, a marker can also be placed at an absolute position using CSS positioning, in which case the chart does not control the marker's positioning.
The default placement function for any markers is CIQ.ChartEngine#defaultMarkerPlacement.
See the Markers tutorial for additional implementation details and information about managing performance on deployments requiring a large number of markers.
Parameters:
| Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
params |
Object | Parameters that describe the marker. Properties
|
- Since:
-
- 15-07-01
- 05-2016-10 Added the following
params.yPositionervalues: "value", "above_candle", "below_candle", "on_candle", "top", and "bottom". - 8.6.0 Added
params.xPositioneroptions "tick",params.yPositioneroptions "top_lane", and "bottom_lane".
Example
new CIQ.Marker({
stx: stxx,
xPositioner: "date",
yPositioner: "value",
x: someDate,
y: somePrice,
label: "events",
node: newNode,
});
Classes
Methods
-
initializeScrollBehavior(node)
-
Initializes the scroll behavior of marker expands.
For proper styling, the perfect scrollbar requires elements to have been mounted on the DOM prior to initialization. As a result, this function should only be called on mounted nodes.
Parameters:
Name Type Description nodeHTMLElement The marker that contains the expand for which scroll behavior is initialized.
- Since:
-
8.2.0
-
positionContentVerticalAndHorizontal(node [, evenIfNotVisible])
-
Content positioner for any markers using the 'stx-marker-expand' class. It takes into consideration the marker's node location within its container and determines where to place the content so it is all showing regardless if it is to the left, right, top, or bottom of the marker node.
Parameters:
Name Type Argument Description nodeHTMLElement The HTML element representing the marker which has content.
evenIfNotVisibleboolean <optional>
True to position the marker even if not visible. This makes any transition of the marker appear to be in the correct place. Note that positioning invisible markers will negatively affect performance.
- Since:
-
- 5.1.2
- 8.6.0 Added
evenIfNotVisibleparameter.
-
removeByLabel(stx, label)
-
Removes all markers with the specified label from the chart object
Parameters:
Name Type Description stxCIQ.ChartEngine The chart object
labelstring The label
- Since:
-
15-07-01
-
click(params)
-
Called when a marker node is clicked. Checks to see whether the node has its own click function and, if it does, calls that function, passing all arguments to it.
Parameters:
Name Type Description paramsobject Configuration parameters.
Properties
Name Type Description cxnumber The clientX coordinate of the click event.
cynumber The clientY coordinate of the click event.
panelCIQ.ChartEngine.Panel Panel where the click took place.
- Since:
-
- 7.2.0
- 8.0.0 Signature changed to accept the
paramsobject.
-
<abstract> doubleClick(params)
-
Called when a marker node is double-clicked.
Override this function with your own implementation. Return a truthy value to prevent CIQ.ChartEngine#doubleClick from dispatching the "doubleClick" event and invoking the doubleClickEventListener.
Parameters:
Name Type Description paramsobject Configuration parameters.
Properties
Name Type Description cxnumber The clientX coordinate of the double-click event.
cynumber The clientY coordinate of the double-click event.
panelCIQ.ChartEngine.Panel Panel where the double-click took place.
- Since:
-
8.0.0
Returns:
true to indicate the double-click event has been handled; otherwise, false.
- Type
- boolean
-
remove()
-
Removes the marker from the chart object
- Since:
-
15-07-01
-
render()
-
Normally the chart will take care of positioning the marker automatically but you can force a marker to render itself by calling this method. This will cause the marker to call its placement function. You might want to do this for instance if your marker morphs or changes position outside of the animation loop.
