new Chart()
The Chart class contains a collection of methods used to instantiate and configure charts and the chart user interface.
The decisions on what to initiate and how it gets initiated are based on the provided configuration object and the availability of resources loaded in the CIQ namespace.
- Since:
-
7.5.0
Methods
-
breakpointSetter(uiContext)
-
Returns a setter that updates the responsive break point of the chart components.
Parameters:
Name Type Description uiContextCIQ.UI.Context The chart user interface context.
- Since:
-
7.5.0
Returns:
A function that sets the responsive break point of the UI context.
- Type
- function
-
chartAreaTopSetter(uiContext)
-
Returns a setter that updates the top position of the chart area (the HTML element that has the CSS class
ciq-chart-area) based on the height of the plug-ins panel.Parameters:
Name Type Description uiContextCIQ.UI.Context The chart user interface context.
- Since:
-
8.9.0 Deprecated
- Deprecated:
-
no longer used
Returns:
A function that sets the top position of the chart area.
- Type
- function
-
chartPositionSetter(uiContext)
-
Returns a setter function that updates the size of the side navigation panel by positioning the chart container
div.Parameters:
Name Type Description uiContextCIQ.UI.Context The chart user interface context.
- Since:
-
7.5.0
Returns:
A function that sets the size of the side navigation panel.
- Type
- function
-
classSetter(uiContext)
-
Returns a setter that updates the class name of the chart components.
Parameters:
Name Type Description uiContextCIQ.UI.Context The chart user interface context.
- Since:
-
8.8.0
Returns:
A function that sets the class of the UI context.
- Type
- function
-
createChartAndUI( [params])
-
Creates the chart engine and user interface, including the UI context.
Parameters:
Name Type Argument Description paramsobject <optional>
Function parameters.
Properties
Name Type Argument Description containerHTMLElement <optional>
The HTML element that hosts the user interface elements of the chart. The element is a
cq-contextelement, or it contains acq-contextelement or element with acq-contextattribute. The context element, in turn, contains a chart container element; that is, an element with classchartContainer.configobject <optional>
Configuration for the chart engine, UI elements, and plug-ins. See the Chart Configuration tutorial for more information.
- Since:
-
7.5.0
Returns:
The chart UI context.
- Type
- CIQ.UI.Context
-
getBreakpoint(width [, height])
-
Determines responsive design breakpoints based on numeric width and height values.
Width breakpoints:
- small — "break-sm"
- medium — "break-md"
- large — "break-lg"
Height breakpoints:
- small — "break-height-sm"
- medium — "break-height-md"
- large — "break-height-lg"
Parameters:
Name Type Argument Description widthnumber The width in pixels for which a breakpoint is determined.
heightnumber <optional>
The height in pixels for which a breakpoint is determined.
- Since:
-
8.2.1 Added the
heightparameter. Added thestring[]type to the return value.
Returns:
The width breakpoint if the optional
heightparameter is not provided; for example, "break-sm". Ifheightis provided, returns an array containing the width breakpoint and height breakpoint; for example["break-sm", "break-height-sm"].- Type
- string | Array.<string>
-
getKeystrokeHubSetter(uiContext, keystrokeHub)
-
Gets a callback that set the active context of the keystroke hub based on the mouse pointer location.
When multiple charts are on a page, the chart with the mouse pointer over it responds to keyboard input, such as shortcuts or symbol entry.
Parameters:
Name Type Description uiContextCIQ.UI.Context The chart user interface context.
keystrokeHubCIQ.UI.KeystrokeHub A reference to the keystroke hub.
- Since:
-
7.5.0
Returns:
A callback that sets the active context of the keystroke hub.
- Type
- function
-
initColorPicker(uiContext)
-
Creates and appends a cq-color-picker component to the document body if one is not already attached.
Parameters:
Name Type Description uiContextCIQ.UI.Context The chart user interface context.
- Since:
-
- 7.5.0
- 8.5.0 Added
uiContextparameter.
-
initContainerListeners(uiContext)
-
Initializes the chart container size change listener, channel subscriptions, and the keystroke hub and its focus management (see CIQ.UI.KeystrokeHub).
Parameters:
Name Type Description uiContextCIQ.UI.Context The chart user interface context.
- Since:
-
7.5.0
-
initDialogHandler(uiContext)
-
Subscribes to the dialog channel.
Creates an element for the requested dialog if one does not exist in the document scope. Opens the dialog in response to channel messages.
Parameters:
Name Type Description uiContextCIQ.UI.Context The chart user interface context.
- Since:
-
7.5.0
-
initDrawingEditListeners(uiContext)
-
Creates a CIQ.UI.DrawingEdit helper and adds listeners to the helper. The listeners post messages in the drawing channel when drawing starts and ends.
Parameters:
Name Type Description uiContextCIQ.UI.Context The chart user interface context.
- Since:
-
7.5.0
-
initDrawingTools(uiContext)
-
Subscribes to the drawing channel to manage drawing tool visibility based on channel messages.
Parameters:
Name Type Description uiContextCIQ.UI.Context The chart user interface context.
- Since:
-
7.5.0
-
initEventMarkers(uiContext)
-
Initiates event marker functionality.
Parameters:
Name Type Description uiContextCIQ.UI.Context The chart user interface context.
- Since:
-
7.5.0
-
initExtensions(params)
-
Installs plug-ins.
See CIQ.ChartEngine.create for the installation of add-ons.
Parameters:
Name Type Description paramsobject Function parameters.
Properties
Name Type Argument Description stxCIQ.ChartEngine <optional>
A reference to the chart engine.
uiContextCIQ.UI.Context <optional>
The chart user interface context.
typestring <optional>
Type of extension. Currently, only "plugins" is supported.
- Since:
-
- 7.5.0
- 8.8.0 Removed unnecessary parameter
config.
-
initKeystrokeHub(uiContext)
-
Attaches a CIQ.UI.KeystrokeHub to the
bodyelement to enable users to start typing anywhere on the page to activate the chart's symbol input box.Modify this method to use a different tag, such as a
div, if this behavior is too broad for your implementation.Parameters:
Name Type Description uiContextCIQ.UI.Context The chart user interface context.
- Since:
-
7.5.0
-
initLookup(uiContext)
-
Creates a symbol change filter and attaches it to the chart UI context and lookup containers.
Parameters:
Name Type Description uiContextCIQ.UI.Context The chart user interface context.
Properties
Name Type Description configobject Configuration parameters.
Properties
Name Type Argument Description onNewSymbolLoadobject <optional>
Contains two functions,
removeSeriesandloadError. Either or both functions can be omitted. See the Chart Configuration tutorial for more information.restoreboolean <optional>
Indicates whether to save and restore the chart layout, preferences, and drawings.
chartIdstring <optional>
Identifies the chart.
selectorobject <optional>
An assortment of CSS selectors used to obtain references to the DOM nodes that represent the chart elements named by the object properties.
lookupDriverfunction <optional>
A function definition for the chart's default symbol lookup driver.
topNodeHTMLElement The top node of the DOM tree for this context. Should contain all of the UI elements associated with the chart engine.
- Since:
-
7.5.0
-
initMenusAndToggles(uiContext)
-
Sets up MenuConfig and ToggleConfig helpers to allow for custom menu configuration.
Parameters:
Name Type Description uiContextCIQ.UI.Context The chart user interface context.
- Since:
-
8.9.0
-
loadChart(uiContext)
-
Loads a chart with an initial symbol. When configured to restore the layout (which is the default), recreates the settings used in the previous session, including the last viewed symbol.
Parameters:
Name Type Description uiContextCIQ.UI.Context The chart user interface context.
Properties
Name Type Argument Description stxCIQ.ChartEngine A reference to the chart engine.
configobject <optional>
Configuration parameters.
Properties
Name Type Argument Description chartIdstring <optional>
Identifies the chart.
restoreboolean <optional>
Indicates whether to save and restore the chart layout, preferences, and drawings.
onChartReadyfunction <optional>
A callback function to call when the chart has loaded.
initialDataarray <optional>
An array of formatted objects which provide the chart data.
loaderCIQ.UI~Loader <optional>
A web component instance that shows loading status.
- Since:
-
- 7.5.0
- 8.2.0 Added the
config.onChartReadyandconfig.initialDataparameters. - 8.8.0 Moved preferences restore into its own function (loadPreferences).
-
loadPreferences(uiContext)
-
Loads chart preferences, such as language and time zone.
Parameters:
Name Type Description uiContextCIQ.UI.Context The chart user interface context.
Properties
Name Type Argument Description stxCIQ.ChartEngine A reference to the chart engine.
topNodeHTMLElement The top node of the DOM tree for this context. Should contain all of the UI elements associated with chart engine.
configobject <optional>
Configuration parameters.
Properties
Name Type Argument Description chartIdstring <optional>
Identifies the chart.
restoreboolean <optional>
Indicates whether to save and restore the chart. layout, preferences, and drawings.
- Since:
-
8.8.0 Moved this functionality out of loadChart.
-
notifySizeChanges(uiContext)
-
Event handler for chart container size changes. Posts messages in the
breakpointandcontainerSizechannels when the context container size has changed.Listening for container size changes in some browsers can be inefficient. This function improves notification efficiency by posting messages for specific changes, such as changes in responsive layout break points.
Parameters:
Name Type Description uiContextCIQ.UI.Context The chart user interface context.
- Since:
-
7.5.0
-
sidenavSizeSetter(uiContext)
-
Returns a setter that updates the width of the side navigation panel by positioning the chart area (the HTML element that has the CSS class
ciq-chart-area).Parameters:
Name Type Description uiContextCIQ.UI.Context The chart user interface context.
- Since:
-
7.5.0
Returns:
A function that sets the size of the side navigation panel.
- Type
- function
-
sidepanelSizeSetter(uiContext)
-
Returns a setter that updates the width of the side panel by setting the right position of the chart area (the HTML element that has the CSS class
ciq-chart-area) and the right margin of the Analyst Views plug-in,cq-analystviews.Parameters:
Name Type Description uiContextCIQ.UI.Context The chart user interface context.
- Since:
-
7.5.0
Returns:
A function that sets the width of the side panel.
- Type
- function
