API Reference
Namespaces
Classes
Events
Global
Externals

Namespace: cq-studies

WebComponents. cq-studies

Studies list web component <cq-studies>.

Lists all studies contained in the study library.

Optionally show and manage favorites.

Since:
  • 5.2.0
  • 8.8.0 Added cq-favorites flag.

Example

<cq-menu class="ciq-menu ciq-studies collapse">
	<span>Studies</span>
	<cq-menu-dropdown cq-no-scroll>
		<cq-study-legend cq-no-close>
			<cq-section-dynamic>
				<cq-heading>Current Studies</cq-heading>
				<cq-study-legend-content>
					<template>
						<cq-item>
							<cq-label class="click-to-edit"></cq-label>
							<div class="ciq-icon ciq-close"></div>
						</cq-item>
					</template>
				</cq-study-legend-content>
				<cq-placeholder>
					<div stxtap="Layout.clearStudies()" class="ciq-btn sm">
						Clear All
					</div>
				</cq-placeholder>
			</cq-section-dynamic>
		</cq-study-legend>
		<cq-scroll>
			<cq-studies>
				<cq-studies-content>
					<template>
						<cq-item>
							<cq-label></cq-label>
						</cq-item>
					</template>
				</cq-studies-content>
			</cq-studies>
		</cq-scroll>
	</cq-menu-dropdown>
</cq-menu>

Methods


initialize( [params])

Initializes and displays the list of available studies.

Parameters:
Name Type Argument Description
params object <optional>

Parameters to control initialization of the studies list.

Properties
Name Type Argument Default Description
excludedStudies object <optional>

A map of study names that should be excluded from the studies list, for example: { "macd": true }.

alwaysDisplayDialog object | boolean <optional>
false

If set to boolean true (not truthy), the study edit dialog box is automatically opened for any of the available studies after the study has been added to the chart. If set to boolean false, the study edit dialog box is not opened for any of the available studies after the study has been added to the chart.

If set to an object containing a map of study names and boolean values (for example, { "ma": true, "AVWAP": true }), the study edit dialog box is opened after the study has been added to the chart for studies in the map that have a boolean value of true but not for those that have a value of false or for any studies not included in the map.

dialogBeforeAddingStudy object | boolean <optional>
false

If set to boolean true (not truthy), the study edit dialog box is automatically opened for any of the available studies before the study is added to the chart. If set to boolean false, the study edit dialog box is not opened for any of the available studies before the study is added to the chart.

If set to an object containing a map of study names and boolean values (for example, { "macd": true }), the study edit dialog box is opened before the study is added to the chart for studies in the map that have a boolean value of true but not for those that have a value of false or for any studies not included in the map.

Since:
  • 5.2.0 The CIQ.UI.StudyMenu helper has been deprecated. Please call document.querySelector("cq-studies").initialize() now.

Example
let params = {
	excludedStudies: { macd: true }, // Exclude studies from the list of available studies.
	alwaysDisplayDialog: { ma: true }, // Show the study preferences dialog after adding studies.
	dialogBeforeAddingStudy: { rsi: true }, // Show the study preferences dialog before adding studies.
};
document.querySelectorAll("cq-studies").forEach(function (i) {
	i.initialize(params);
});

renderMenu(stx)

Creates a list of studies in a <cq-studies-content> element.

You have the option of creating a hardcoded HTML menu and just using CIQ.Studies for processing stxtap attributes, or you can call this method to automatically generate the menu.

Parameters:
Name Type Description
stx CIQ.ChartEngine

The chart object

Since:
  • 8.8.0 Added stx parameter.