new cq-curve-comparison()
The curve comparison web component, <cq-curve-comparison>, enables the addition of
secondary curves to cross section charts. The secondary curves plot instrument data for
entities that are comparable to the chart's primary entity (such as the U.K. sovereign bond
in comparison to the U.S. Treasury benchmark).
A typical implementation of the component includes:
- A drop-down menu that enables the addition of entity curves
- An entity lookup dialog box which is opened from the drop-down menu
See the example below.
- Since:
-
7.5.0
- See:
Example
<!-- Add the cq-marker attribute to make the component a visual element of the chart. -->
<cq-curve-comparison cq-marker class="ciq-comparison ciq-entity-comparison">
<cq-menu class="cq-comparison-new">
<cq-comparison-tap-capture>
<!-- Add the component label. -->
<cq-comparison-add-label class="ciq-no-share">
<cq-comparison-plus></cq-comparison-plus><span>Compare</span><span>...</span>
</cq-comparison-add-label>
<!-- Create the drop-down menu that appears when the component is selected. -->
<cq-menu class="ciq-comparison-curve-menu">
<cq-menu-dropdown class="ciq-value-dropdown">
<cq-item stxtap="Layout.showEntityComparison()">Add Entity</cq-item>
<cq-item stxtap="Layout.showHistoricalComparisonDialog()">Add Historical</cq-item>
</cq-menu-dropdown>
</cq-menu>
<!-- Add the entity lookup dialog box which is opened by the call to Layout.showentityComparison() from the drop-down menu. -->
<cq-comparison-add>
<cq-comparison-lookup-frame>
<cq-lookup cq-keystroke-claim cq-keystroke-default cq-uppercase cq-exchanges="futures,govt,muni,corp">
<cq-lookup-input cq-no-close>
<input type="text" spellcheck="false" autocomplete="off" autocorrect="off" autocapitalize="none"
name="symbol" placeholder="">
<cq-lookup-icon></cq-lookup-icon>
</cq-lookup-input>
<cq-lookup-results>
<cq-lookup-filters cq-no-close>
<cq-filter class="true">ALL</cq-filter>
<cq-filter>BONDS</cq-filter>
<cq-filter>FUTURES</cq-filter>
</cq-lookup-filters>
<cq-scroll></cq-scroll>
</cq-lookup-results>
</cq-lookup>
</cq-comparison-lookup-frame>
<cq-swatch cq-no-close></cq-swatch>
<span><cq-accept-btn class="stx-btn">ADD</cq-accept-btn></span>
</cq-comparison-add>
</cq-comparison-tap-capture>
</cq-menu>
</cq-curve-comparison>
Extends
Members
-
loading :Array.<string>
-
Type:
- Array.<string>
-
swatchColors :Array.<string>
-
CSS-friendly representation of swatch color(s)
Type:
- Array.<string>
Methods
-
addClaim()
-
Claim any keystrokes that come in. Once claimed, any keystrokes that come in are passed to the element. The element can then choose to capture or propagate the keystrokes. This enables an element to capture keystrokes even if it doesn't have mouse focus.
- Inherited From:
-
addDefaultMarkup(component [, markup])
-
Adds default markup to a web component if the component does not have any child nodes.
Parameters:
Name Type Argument Description componentHTMLElement The component to which the markup is added.
markupString <optional>
The markup to add to the web component. Unused if the component has a static markup property that specifies the markup; for example, MyComponent.markup.
- Since:
-
7.5.0
- Inherited From:
-
channelMergeObject(path, value, stx)
-
Merges an object in the chart engine communication channel.
Parameters:
Name Type Description pathString The channel path.
valueObject The value merged to the channel.
stxCIQ.ChartEngine A reference to the chart engine.
- Since:
-
7.5.0
- Inherited From:
-
channelRead(path [, stx])
-
Reads the current value in the chart engine communication channel.
Parameters:
Name Type Argument Description pathString The channel path.
stxCIQ.ChartEngine <optional>
Unused.
- Since:
-
7.5.0
- Inherited From:
Returns:
The current value in channel.
- Type
- *
-
channelSubscribe(path, cb, stx)
-
Subscribes to the chart engine messaging channel.
Parameters:
Name Type Description path* The channel path.
cb* A callback invoked upon subscribing and whenever a new message is posted in the channel.
stxCIQ.ChartEngine A reference to the chart engine.
- Since:
-
7.5.0
- Inherited From:
Returns:
A callback invoked when unsubscribing from the channel.
- Type
- function
-
channelWrite(path, value, stx)
-
Writes in the chart engine communication channel.
Parameters:
Name Type Description pathString The channel path.
value* The value written to the channel.
stxCIQ.ChartEngine A reference to the chart engine.
- Since:
-
7.5.0
- Inherited From:
-
clickFocusedItem(items, e)
-
Selects (clicks) the first element in
itemsthat has acq-focusedattribute.Parameters:
Name Type Description itemsNodeList A list of elements that are selectable via keyboard navigation.
eEvent The keystroke event.
- Since:
-
8.3.0
- Inherited From:
-
deactivateItem(item)
-
Blurs and removes the
cq-keyboard-activeattribute fromitem.Parameters:
Name Type Description itemHTMLElement - Since:
-
8.4.0
- Inherited From:
-
disconnectedCallback()
-
Removes all the the injections for a context tag and resets the tag to its default state.
Designed to be used as a helper method for the included WebComponents. A full tutorial on how to work with and customize the WebComponents can be found here: Web Component Interface.
- Inherited From:
-
emitCustomEvent(params)
-
Emits a custom event from the webcomponent. The event type of the emitted event is determined by the particular user action taken. Up to two events are emitted when this function is executed. The first is an event with the type of action performed, if there is one. For example, events which are spawned without user action will not emit this first event. The second event will have a type derived from the component name. For example, the
cq-study-legendcomponent will emit a "StudyLegend" type event. The payload of the event will contain a detail section specifying the component which emitted the event as well as theeffect- which more clearly defines the type of action causing the emittance. The detail section may also include custom fields further categorizing the event and providing additional information. These details are documented within the web component's documentation.Parameters:
Name Type Description paramsobject Properties
Name Type Argument Default Description causestring <optional>
The cause of the event. e.g., useraction, timeout, alert. Defaults to "useraction" if not set and
actionparameter is set.effectstring <optional>
The effect of the user's action. Required if not provided in
detail. e.g., open, help, toggle, select.actionstring | null <optional>
"click" The action a user performed, if applicable. e.g. click, longpress, drag. Set to null if no user action was performed.
detailObject <optional>
{} Optional extra parameters to include in the detail of the Custom Event.
- Since:
-
- 8.9.0
- 9.1.0 Changed
paramsobject's property names.
- Inherited From:
-
findFocused(items)
-
Finds the elements in
itemsthat have acq-focusedattribute.Parameters:
Name Type Description itemsNodeList A list of elements that are selectable via keyboard navigation.
- Since:
-
8.3.0
- Inherited From:
Returns:
The elements in
itemsthat have acq-focusedattribute, or an empty array if no elements are found.- Type
- array
-
findKeyboardActive(items)
-
Finds the elements in
itemsthat have acq-keyboard-activeattribute.Parameters:
Name Type Description itemsNodeList A list of elements that are selectable via keyboard navigation
- Since:
-
8.4.0
- Inherited From:
Returns:
The elements in
itemsthat have acq-keyboard-activeattribute, or an empty array if no elements are found.- Type
- Array
-
focusItem(item)
-
Adds a
cq-focusedattribute toitemand highlightsitem.Parameters:
Name Type Description itemHTMLElement Element that receives keyboard focus and is highlighted.
- Since:
-
8.3.0
- Inherited From:
-
focusNextItem(items [, reverse] [, loop])
-
Focuses the next item in the tab order.
Locates the first element in
itemsthat has acq-focusedattribute. If an element is found, the attribute is removed from all elements initems, andcq-focusedis applied to the element that follows (in the tab order) the element that was found.If no elements are found with the
cq-focusedattribute, the attribute is applied to the first element initems(last element ifreverseis true). If the last element initems(first element ifreverseis true) is found to have thecq-focusedattribute, focus remains on that element. Unlessloopis set to true, then focus is applied to first element.Parameters:
Name Type Argument Description itemsNodeList A list of elements that are selectable via keyboard navigation.
reverseboolean <optional>
If true, the operation is performed in reverse order; that is, from the last element in
itemsto the first.loopboolean <optional>
Loops back to the first item if the last element in
itemsis selected.- Since:
-
8.4.0 Added loop parameter. Return element, instead of true, if focus is changed.
- Inherited From:
- See:
Returns:
The newly focused element if a
cq-focusedattribute has changed.- Type
- HTMLElement | undefined
-
getChartContainer( [el])
-
Searches the DOM for the chart container element. Begins the search with
el(orthis) and proceeds parent-by-parent up the ancestry tree until an element is found.Parameters:
Name Type Argument Description elHTMLElement <optional>
The element on which to start the search. If not provided,
thisis used.- Since:
-
7.5.0
- Inherited From:
Returns:
The chart container element or undefined if an element is not found.
- Type
- HTMLElement | undefined
-
getContextContainer( [el])
-
Searches the DOM for the chart context element. Begins the search with
el(orthisifelis not provided) and proceeds up the ancestry tree until an element is found or the root of the tree has been reached.Parameters:
Name Type Argument Description elHTMLElement <optional>
The element on which to start the search. If not provided,
thisis used.- Since:
-
7.5.0
- Inherited From:
Returns:
The chart context element or undefined if an element is not found.
- Type
- HTMLElement | undefined
-
inputEntry(node, cb)
-
Attaches a keyboard input entry event.
Parameters:
Name Type Description nodeHTMLElement The element to which the input entry event is attached.
cbfunction The callback function invoked when input entry occurs.
- Inherited From:
-
modalBegin()
-
Begin a modal on this component.
- Inherited From:
-
modalEnd()
-
End a modal on this component.
- Inherited From:
-
qs(path, context)
-
Adapts the querySelector method.
Parameters:
Name Type Description pathString The CSS selectors for which to search.
contextHTMLElement | String The chart context element, which is the starting point of the DOM query, or "thisChart" to indicate the chart context in which this function is called.
- Since:
-
7.5.0
- Inherited From:
Returns:
The selected DOM element or undefined if an element is not found.
- Type
- HTMLElement | undefined
-
qsa(path, root, bustShadowRoots)
-
Adapts the querySelectorAll method. Returns an array instead of a node list to enable chaining of the array
map,filter,forEach, andreducefunctions.Parameters:
Name Type Description pathString The CSS selectors to find.
rootHTMLElement | String The root element, which is the starting point of the DOM query, or "thisChart" to indicate the chart context in which this function is called.
bustShadowRootsboolean Set to true to penetrate shadow root boundaries.
- Since:
-
- 7.5.0
- 8.9.0 Added
bustShadowRootsparameter
- Inherited From:
Returns:
An array of selected DOM element.
- Type
- Array.<HTMLElement>
-
removeClaim()
-
Remove a claim on keystrokes.
- Inherited From:
-
removeFocused(items)
-
Removes the
cq-focusedattribute from all elements initems.Parameters:
Name Type Description itemsNodeList A list of elements that are selectable via keyboard navigation.
- Since:
-
8.3.0
- Inherited From:
-
<abstract> setContext(context)
-
Called for a registered component when the context is constructed. This method does nothing; you must override it with a method that performs context initialization.
Parameters:
Name Type Description contextCIQ.UI.Context The chart user interface context.
- Inherited From:
-
setContextHolder()
-
Stores the component in the context holder (an array associated with the
cq-contextelement) so that when the context is started, it knows that this tag is contextual.Designed to be used as a helper method for the included WebComponents. A full tutorial on how to work with and customize the WebComponents can be found here: Web Component Interface.
- Inherited From:
-
trimInnerHTMLWhitespace()
-
Returns a copy of the innerHTML of an element, with leading and trailing characters stripped. The following characters are stripped: newline, carriage return, tab.
- Since:
-
9.1.0
- Inherited From:
Returns:
Trimmed innerHTML
- Type
- String
-
pickSwatchColor()
-
Sets the background color of a cq-swatch element contained in a cq-curve-comparison.
- Since:
-
7.5.0
-
removeCurve(curveId)
-
Removes a secondary curve from the chart. Responds to selection of the
control associated with the curve in the
cq-study-legend, which displays the list of
secondary curves.Parameters:
Name Type Description curveIdString Identifies the curve to be removed.
- Since:
-
7.5.0
-
renderLegend()
-
Creates the list of secondary curves displayed in the cq-study-legend.
- Since:
-
7.5.0
-
selectItem(obj)
-
Adds a secondary curve to the chart based on the selection of a symbol from the entity lookup dialog box. Sets the curve color to that of the entity lookup's color swatch.
Parameters:
Name Type Description objobject Contains information about the selected entity.
Properties
Name Type Description symbolstring The symbol of the selected entity.
- Since:
-
- 7.5.0
- 8.2.0 Removed the
contextparameter. The context is now accessed from the base component class.
-
setColor(color, swatch)
-
Sets the color of a curve. Responds to a change in the color of the swatch associated with the curve in the cq-study-legend, which displays the list of secondary curves.
Parameters:
Name Type Description colorString The color to apply to the curve.
swatchObject Represents the color swatch associated with the curve in the cq-study-legend. Identifies the curve.
- Since:
-
7.5.0
