API Reference

Namespace: cq-comparison

WebComponents. cq-comparison

Symbol comparison component <cq-comparison>.

Add attribute cq-marker to have the component insert itself as a marker on the chart.

For cq-comparison-keys:

  • Add attribute cq-panel-only to have the component show only series in the panel
  • Add attribute cq-all-series to have the component show even non-comparison series in the legend


  • By default, the comparison web component will not connect gaps in the data to indicate data points are missing due to discrepancies between marker hours or due to thinly traded instruments. If you want it to behave differently, you will need to override these defaults. Do not make the changes directly on components.js, but rather create a separate file with a copy of the methods you are overwriting and load that file right after the components.js file is loaded, but before any web components are instantiated. This allows for easier upgrades. Look for the addSeries call and use the gapDisplayStyle parameter (or any other required parameter) as outlined in CIQ.ChartEngine#addSeries.

  • To adjust the comparison's automatic color selector, set document.querySelector('cq-comparison').swatchColors to an array of colors. To adjust colors from the color picker popup, execute:

    const picker = document.querySelector('cq-color-picker');
    picker.params.colorMap=[[row 1 of colors],[row 2 of colors],[row 3 of colors],[etc.]]

    You can use cq-swatch rather than cq-comparison-swatch to allow user to change the series color.

  • 7.3.0 Added the ability to set series color using cq-swatch.


document.querySelector("cq-comparison").swatchColors = ["rgb(142, 198, 72)"];
const picker = document.querySelector("cq-color-picker");
picker.params.colorMap = [
<cq-comparison cq-marker>
    <cq-menu class="cq-comparison-new">
                <cq-lookup cq-keystroke-claim>
                    <cq-lookup-input cq-no-close>
                        <input type="text" cq-focus spellcheck="false" autocomplete="off" autocorrect="off"
                                           autocapitalize="none" placeholder="">
                        <cq-lookup-filters cq-no-close>
                            <cq-filter class="true">ALL</cq-filter>
            <cq-swatch cq-no-close></cq-swatch>
            <span><cq-accept-btn class="stx-btn">ADD</cq-accept-btn></span>
        <template cq-comparison-item>
                <!-- cq-comparison-price displays the current price with color animation -->
                <cq-comparison-price cq-animate></cq-comparison-price>
                <!-- cq-comparison-tick-price displays the price for the active crosshair item -->
                <!-- <cq-comparison-tick-price></cq-comparison-tick-price>    -->
                <div class="stx-btn-ico ciq-close"></div>



Initializes all the children UI elements that make up <cq-comparison>.


Triggers the comparison lookup component and passes keyboard control into the internal cq-lookup element.

Called when keyboard navigation activates this element by pressing Return/Enter.

  • 8.3.0


Picks a color to display the new comparison as. Loops through preset colors and picks the next one on the list. If the all colors are taken then the last color will be repeated.

removeSeries(symbol, series)

Handles removing a series from the comparison.

Name Type Description
symbol string

Name of series as a string.

series object

Object containing info on series.


The legend gets re-rendered whenever we createDataSet() (wherein the series may have changed). We re-render the entire thing each time, but we use a virtual DOM to determine whether to actually change anything on the screen (so as to avoid unnecessary flickering)


Fires whenever a new security is added as a comparison. Handles all the necessary events to update the chart with the new comparison.

Name Type Description
obj object

Contains information about the security.

Name Type Description
symbol string

The symbol that identifies the security.

  • 8.2.0 Removed the context parameter. The context is now accessed from the base component class.

setColor(color, swatch)

Changes the color of a series; triggered if using cq-swatch to show the series color.

Name Type Description
color string

New color.

swatch object

Swatch from which the color setting is made.

  • 7.3.0


Adds an injection to the ChartEngine that tracks the price of Comparisons.

Name Type Description
updatePrices number


Loops thru stxx.chart.series to update the current price of all comparisons.