Namespace: UI

CIQ. UI

Namespace for UI helper objects

Classes

Context
DrawingEdit
HeadsUp
Helper
KeyboardShortcuts
Keystroke
Layout
Lookup
StudyEdit

Namespaces

BaseComponent
ContextTag
DialogContentTag
ModalTag

Methods


animatePrice(node, newPrice, oldPrice)

Convenience function to display the changing price of a node (price flash green/red).

This functionality can be CPU expensive if many updates per second or multiple charts on a screen exist. To disable simply set CIQ.UI.animatePrice = function () { };

Parameters:
Name Type Description
node node
newPrice number
oldPrice number

containerExecute(self, fn, args)

Executes a function in the nearest parent component (container). For instance, a cq-close tag might call "close" on its containing component

Parameters:
Name Type Description
self object
fn string

The name of the function

args Array

Arguments array (a "spread" is also supported)


makeFromTemplate(node [, appendTo])

Convenience function for making a new jquery node from a HTML5 template

Parameters:
Name Type Argument Description
node Selector

Selector or HTMLElement

appendTo HTMLElement <optional>

If set, then the template will automatically be appended to this node. If appendTo==true then the new node will automatically be added in place (appended to the template's parent)

Returns:

A jquery node

Type
JQuery

observe(params)

Static method to create an observable

Parameters:
Name Type Description
params Object

Parameters

Properties
Name Type Argument Description
selector string <optional>

The selector to effect the observable (adding class, setting value)

obj Object

The object to observe

member string <optional>

The member of the object to observe. Pass an array to observe multiple members. Or pass nothing to observe any change to the object.

condition string <optional>

Optional condition for the member to trigger the action

action string

The action to take. "class" - add or remove a class. "callback" - calls back with params

value string

The value for the action (i.e. class name, callback function)

Examples
- Add or remove a class based on whether stx.layout.crosshair is true or false
CIQ.UI.observe({selector:".toggle", obj:stx.layout, member:"crosshair", action:"class", value:"active"});
- Add or remove a class based on whether stx.layout.chartType=="candle"
CIQ.UI.observe({selector:".toggle", obj:stx.layout, member:"chartType", condition:"candle", action:"class", value:"active"});
- Get a callback from a change in value
CIQ.UI.observe({selector:".toggle", obj:stx.layout, member:"chartType", condition:"candle", action:"callback", value:function(params){
   console.log("new value is" + params.obj[params.member]);
}});