Methods
-
get(params)
-
Gets a floating window instance.
If the
tagparameter is provided, the function checks whether the document already contains a floating window with that tag. If so, the function parameters are stored as properties of the floating window object (see setProps), and a reference to the floating window is returned. Otherwise, the function returns a new floating window created with the provided parameters.Note: Tags can be used to manage floating windows in multi-chart documents. For more information, see the
tagparameter of floatingWindowEventListener.Parameters:
Name Type Description paramsobject Floating window parameters.
Properties
Name Type Argument Description contentstring The contents of the floating window, typically an HTML string.
containerHTMLElement <optional>
The DOM element that visually contains the floating window. The floating window is positioned on screen relative to the container element (see positionRelativeTo).
titlestring <optional>
Text that appears in the title bar of the floating window.
tagstring <optional>
A label that identifies the floating window type; for example, "shortcut", which indicates that the floating window contains the chart keyboard shortcuts legend.
minWidthnumber <optional>
The minimum width of the floating window.
minHeightnumber <optional>
The minimum height of the floating window.
onClosefunction <optional>
A callback function to execute when the floating window closes.
- Since:
-
8.2.0
Returns:
A DocWindow instance.
- Type
- object
-
bindEvents()
-
Adds event listeners to the floating window.
The listeners enable the window to be moved, resized, collapsed/expanded, and closed.
- Since:
-
8.2.0
-
clampX(value)
-
Helper function that constrains the floating window to the document view when the window is dragged horizontally.
Clamps the horizontal position of the floating window between 0 (so the window cannot be dragged off the left side of the view) and the width of the document view minus the width of the floating window (so the window cannot be dragged off the right side of the view).
Parameters:
Name Type Description valuenumber The position of the mouse relative to the left edge of the floating window.
- Since:
-
8.2.0
Returns:
The value for the clamped horizontal position of the floating window:
valueifvalueis greater than 0 and less than the width of the document view minus the width of the floating window- 0 if
valueis less than 0 - The width of the document view minus the width of the floating window if
valueis greater than the width of the document view minus the width of the floating window
- Type
- number
-
clampY(n)
-
Helper function that constrains the floating window to the document view when the window is dragged vertically.
Clamps the vertical position of the floating window between 0 (so the window cannot be dragged off the top of the view) and the height of the document view minus the height of the floating window title bar and a margin (so the window title bar cannot be dragged off the bottom of the view).
Parameters:
Name Type Description nnumber The position of the mouse relative to the top edge of the floating window.
- Since:
-
8.2.0
Returns:
The value for the clamped vertical position of the floating window:
nifnis greater than 0 and less than the height of the document view minus the height of the floating window title bar and margin- 0 if
nis less than 0 - The height of the document view minus the height of the floating window title bar and
margin if
nis greater than the height of the document view minus the height of the floating window title bar and margin
- Type
- number
-
ensureVisible()
-
Repositions the floating window (if necessary) when the display is resized to keep the window within the document view.
- Since:
-
8.2.0
-
onMouseMove(e)
-
The event listener for mouse move events that occur when a floating window is being dragged or resized.
Moves or resizes the floating window.
Parameters:
Name Type Description eMouseEvent The mouse event object.
- Since:
-
8.2.0
-
onMouseUp()
-
The event listener for mouse up events that occur on a floating window.
Stops a dragging or resizing action of the floating window.
- Since:
-
8.2.0
-
onStartDrag(e)
-
The event listener for mouse down events that occur on the floating window's title bar.
The mouse down event starts a click-and-drag action on the floating window.
Parameters:
Name Type Description eMouseEvent The mouse event object.
- Since:
-
8.2.0
-
positionRelativeTo(params)
-
Positions the floating window relative to the DOMRect of a DOM element.
Parameters:
Name Type Description paramsobject Positioning parameters.
Properties
Name Type Argument Default Description containerHTMLElement <optional>
The DOM element relative to which the floating window is positioned. Defaults to the
containerparameter of the floatingWindowEventListener or, if thecontainerparameter is not available,document.body.locationstring <optional>
"center" The location of the floating window within the container element's bounding rectangle. If the value is "center" (the default), the floating window is centered horizontally and vertically within the container rectangle. Otherwise, the window is positioned in the upper left corner of the rectangle.
- Since:
-
8.2.0
-
setProps(params)
-
Stores the function parameters as properties of the floating window object.
Parameters:
Name Type Description paramsobject Parameters to store as properties.
Properties
Name Type Argument Description titlestring <optional>
Text that appears in the title bar of the floating window.
contentstring <optional>
The contents of the floating window, typically an HTML string.
containerHTMLElement <optional>
The DOM element that visually contains the floating window. The window is positioned on screen relative to the container element (see positionRelativeTo).
minWidthnumber <optional>
The minimum width of the floating window.
minHeightnumber <optional>
The minimum height of the floating window.
onClosefunction <optional>
A callback function to execute when the floating windows closes.
- Since:
-
8.2.0
-
toggle( [value])
-
Opens and closes the floating window.
Parameters:
Name Type Argument Description valueboolean <optional>
If true, the floating window is opened. If false, the floating window is closed. If undefined, the floating window is toggled; that is, opened if it is currently closed, closed if it is currently open.
- Since:
-
8.2.0
-
toggleCollapse()
-
Toggles the display state — expanded or collapsed — of the floating window.
In the expanded state, the full floating window is displayed; in the collapsed state, only the floating window title bar appears.
- Since:
-
8.2.0
-
update(params)
-
Updates properties of the floating window.
Parameters:
Name Type Description paramsobject Floating window properties.
Properties
Name Type Argument Description xnumber <optional>
The horizontal position of the floating window in pixels.
ynumber <optional>
The vertical position of the floating window in pixels.
widthnumber <optional>
The width of the floating window in pixels.
heightnumber <optional>
The height of the floating window in pixels.
- Since:
-
8.2.0
