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". - 9.1.0 Added
params.candleOffset. Updatedparams.fieldto accept the symbol of a non-primary series. - 9.2.0 Added
params.groupable
Example
new CIQ.Marker({
stx: stxx,
xPositioner: "date",
yPositioner: "value",
x: someDate,
y: somePrice,
field: "someSymbol", // Include if you wish to place the marker on a non-primary series.
label: "events",
node: newNode
});
Classes
Methods
-
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.
-
createSliderMarker()
-
Creates a small marker on the range selector.
Requires "js/extras/pinnedMarkers.js"
- Version:
-
- ChartIQ Extras Package
- Since:
-
9.1.0
-
<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
-
getMarkerGroup()
-
Returns the CIQ.GroupMarker object representing the marker if it is placed in a group.
- Since:
-
9.2.0
Returns:
Marker representing the group
- Type
- CIQ.Marker.Group
-
makeDraggable( [dropzone])
-
Enables or disables a marker's ability to be dragged to within a specified dropzone. If the marker is expandable, the draggable portion is limited to that expandable portion.
This uses the HTML5 Drag and Drop API, which is not well supported on touch devices. As a result, the markers may not be able to be dragged using touch gestures.
Parameters:
Name Type Argument Default Description dropzoneHTMLElement | boolean <optional>
true The container which will receive the dragged marker when it is dropped. Defaults to
true, which will use the marker's panel for the dropzone. Setting this parameter to false will disable dragging.- Since:
-
9.1.0
-
makePinnable( [isTooltip])
-
Makes an event marker pinnable. See CIQ.PinnedMarker for details. If you would like the marker subsystem to manage pinnable markers for you, you can set the
pinnableflag to true for simple and performance markers:CIQ.Marker.Simple.prototype.pinnable = true;CIQ.Marker.Performance.prototype.pinnable = true;Thepinnableflag is read when a marker is created. If you change these flags to true, all new markers of the relevant type pinnable. However, if you then change that flag to false, existing markers will remain pinnable, as the flag is not reread. To turn off the pinnable feature for an existing pinned marker, you must either destroy and recreate this marker or change thepinnableflag at the instance level. as well as all markers created while the flag continues to be true.Requires "js/extras/pinnedMarkers.js"
Parameters:
Name Type Argument Description isTooltipboolean <optional>
If true this is a pinned tooltip, otherwise a pinned marker.
- Version:
-
- ChartIQ Extras Package
- Since:
-
9.1.0
-
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.
-
<static> 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
-
<static> 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. - 9.2.0 Modified to handle positioning of
CIQ.Marker.Groupmarkers
-
<static> 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
