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.yPositioner
values: "value", "above_candle", "below_candle", "on_candle", "top", and "bottom". - 8.6.0 Added
params.xPositioner
options "tick",params.yPositioner
options "top_lane", and "bottom_lane". - 9.1.0 Added
params.candleOffset
. Updatedparams.field
to 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 params
object Configuration parameters.
Properties
Name Type Description cx
number The clientX coordinate of the click event.
cy
number The clientY coordinate of the click event.
panel
CIQ.ChartEngine.Panel Panel where the click took place.
- Since:
-
- 7.2.0
- 8.0.0 Signature changed to accept the
params
object.
-
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 params
object Configuration parameters.
Properties
Name Type Description cx
number The clientX coordinate of the double-click event.
cy
number The clientY coordinate of the double-click event.
panel
CIQ.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 dropzone
HTMLElement | 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
pinnable
flag to true for simple and performance markers:CIQ.Marker.Simple.prototype.pinnable = true;
CIQ.Marker.Performance.prototype.pinnable = true;
Thepinnable
flag 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 thepinnable
flag 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 isTooltip
boolean <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.
-
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 node
HTMLElement 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 node
HTMLElement The HTML element representing the marker which has content.
evenIfNotVisible
boolean <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
evenIfNotVisible
parameter. - 9.2.0 Modified to handle positioning of
CIQ.Marker.Group
markers
-
removeByLabel(stx, label)
-
Removes all markers with the specified label from the chart object
Parameters:
Name Type Description stx
CIQ.ChartEngine The chart object
label
string The label
- Since:
-
15-07-01