Class: PlotComplementer

CIQ. PlotComplementer


new PlotComplementer(params)

Creates an add-on that enables a series to complement another series.

Plot Complementer

The complementary series is a permanent fixture of the series which it complements. It moves in tandem with the series, and gets removed with the series. In all other respects, though, it behaves like its own series. It shows separately in the panel legend and plots using its own renderer.

Charts can have multiple PlotComplementer instances. Each instance is attached to the chart engine as a member of a PlotComplementer collection.

Multiple PlotComplementer instances can be associated with a time series. To link a PlotComplementer to a series, specify the series instrument in the params.filter function. See setQuoteFeed.

Note: The series created by this add-on is not exported with the layout, since it is created in tandem with the series it complements. Currently, this feature works only with non-comparison series.

Parameters:
Name Type Description
params object

Configuration parameters.

Properties
Name Type Argument Default Description
stx CIQ.ChartEngine

The chart object.

id string <optional>

Unique key used by the add-on to identify itself. If not supplied, a random key is chosen.

quoteFeed object <optional>

Attaches the quote feed to the quote driver to satisfy any quote requests for any series created by the add-on.

behavior object <optional>

Used as the behavior for the quote feed supplied in this parameter list.

filter function <optional>

Used as the filter for the quote feed supplied in this parameter list. See setQuoteFeed.

decorator object <optional>

Container object for the symbol and display properties. The decorator provides the label (symbol) for the complementary series and a short description (display) that is appended to the label; for example:

decorator: {symbol:"_fcst", display:" Forecast"}
Properties
Name Type Argument Description
symbol string <optional>

Adds this string onto the ID when creating the complementary series. Otherwise, a unique ID is used.

display string <optional>

Customizes the display value of the series.

renderingParameters object <optional>
{chartType:"line", width:1, opacity:0.5}

A collection of parameters that override the default rendering parameters. The renderingParameters object can be set or changed at any time. The default parameters can be restored by calling CIQ.PlotComplementer#resetRenderingParameters.

Here are a few examples of rendering parameters:

//Assuming a PlotComplementer declared as "forecaster":
forecaster.renderingParameters = {chartType:"scatterplot", opacity:0.5, field:"Certainty"}
forecaster.renderingParameters = {chartType:"histogram", border_color:"transparent", opacity:0.3}
forecaster.renderingParameters = {chartType:"channel", opacity:0.5, pattern:"dotted"}
forecaster.renderingParameters = {chartType:"candle", opacity:0.5, color:"blue", border_color:"blue"}
Since:
  • 7.3.0

Example

Use for Forecasting

var forecaster = new CIQ.PlotComplementer({
	stx: stxx,
	id: "forecast",
	quoteFeed: fcstFeed.quoteFeedForecastSimulator,
	behavior: { refreshInterval: 60 },
	decorator: { symbol: "_fcst", display: " Forecast" },
	renderingParameters: { chartType: "channel", opacity: 0.5, pattern: "dotted" },
});

Methods


resetRenderingParameters()

Resets the PlotComplementer rendering values to the default settings.

Default settings can be provided in the parameters passed to the PlotComplementer constructor. If no settings are provided to the constructor, PlotComplementer uses the following defaults: { chartType:"line", width:1, opacity:0.5 }.

The rendering parameters may be set anytime after creating PlotComplementer; for example, to set an ad-hoc rendering right before adding a series.

Since:
  • 7.3.0


setQuoteFeed()

Sets a quote feed for the PlotComplementer.

Automatically called when a quote feed is provided in the constructor argument. If a quote feed or behavior object is not specified in params, this function returns without doing anything.

Parameters:
Name Type Argument Description
params.quoteFeed object

Quote feed to attach to the quote driver to satisfy any quote requests for any series created by the add-on. This quote feed is like any time series quote feed object. See the Data Integration Overview.

params.behavior object

Behavior for the quote feed supplied in this parameter list. This object is like any behavior object associated with a quote feed. See CIQ.ChartEngine#attachQuoteFeed for more information on behavior objects.

params.filter function <optional>

Filters the quote feed supplied in this parameter list. The filter function takes as an argument an object typically containing symbolObject, symbol, and interval properties. The properties associate the PlotComplementer with an instrument. If the filter function returns true, the PlotComplementer quote feed is used for the instrument.

This filter function is like the filter in basic quote feeds. See CIQ.ChartEngine#attachQuoteFeed for more information on quote feed filter functions.

Since:
  • 7.3.0