new SeriesManager(stx [, config])
Creates series manager by wrapping addSeries, removeSeries and modifySeries methods
Parameters:
| Name | Type | Argument | Description | |||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
stx |
CIQ.ChartEngine | A reference to the chart engine. |
||||||||||||||||||||||||||||||||||||||||||||||
config |
object |
<optional> |
Configuration parameters. Config parameters will affect only new additions. Properties
|
- Since:
-
9.7.0
Example
sm = new SeriesManager(stxx);
sm.clear();
sm.add("NVDA_quarterly", { periodicParams: { }, color: "steelblue" }); // quarterly period
sm.add("SMCI_monthly", { periodicParams: { period: "month" }, color: "darkskyblue" }); // quarterly period with date at the end of month
sm.add("IBM", { color: "gray" }); // market data
sm.add("TSLA", { color: "orange", isComparison: true, labels: {} }); // market data with labels
sm.add("SMCI_fiscal_half", { periodicParams: { period: "fiscal_half" }, color: "aqua" }); // fiscal half year (offset month)
sm.add("NVDA_yearly", { periodicParams: { period: "year"}, color: "lightskyblue" }); // year
Methods
-
add(id [, parameters] [, cb])
-
Wrapper function for chart engine addSeries method. Function signature and available parameter are the same with the difference of defaulting to cluster histogram rendering if no renderer or chartType is provided.
Parameters:
Name Type Argument Description idstring The name of the series. If not passed then a unique ID will be assigned. (parameters.symbol and parameters.symbolObject will default to using id if they are not set explicitly and id is supplied.)
parametersobject <optional>
Parameters to describe the series. Any valid attachSeries parameters and renderer parameters will be passed to attached renderers.
Properties
Name Type Argument Default Description rendererstring <optional>
CIQ.Renderer.Lines Rendering Set to the desired renderer for the series.
- If not set, defaults to Histogram
namestring <optional>
Rendering Set to specify renderer's name. Otherwise,
idwill be used.displaystring <optional>
id/symbol Rendering Set to the text to display on the legend. If not set, the id of the series will be used (usually symbol). If id was not provided, will default to symbol.
symbolstring <optional>
id Data Loading The symbol to fetch in string format. This will be sent into the fetch() function, if no data is provided. If no symbol is provided, series will use the
idas the symbol. If bothsymbolandsymbolObjectare set,symbolObjectwill be used.symbolObjectobject <optional>
id Data Loading The symbol to fetch in object format. This will be sent into the fetch() function, if no data is provided. If no symbolObject is provided, series will use the
idas the symbol. You can send anything you want in the symbol object, but you must always include at least a 'symbol' element. If bothsymbolandsymbolObjectare set,symbolObjectwill be used.fieldstring <optional>
Close/Value Data Loading Specify an alternative field to draw data from (other than the Close/Value). Must be present in your pushed data objects or returned from the quoteFeed.
isComparisonboolean <optional>
false Rendering If set to true, shareYAxis is automatically set to true to display relative values instead of the primary symbol's price labels. CIQ.ChartEngine#setComparison is also called and set to
true. This is only applicable when using the primary y-axis, and should only be used with internal addSeries renderers.shareYAxisboolean <optional>
false Rendering
- Set to
trueso that the series shares the primary y-axis, renders along actual values, and prints the corresponding current price label on the y-axis. - When set to
false, the series will not be attached to a y-axis. Instead, it is superimposed on the chart; taking over its entire height, and maintaining the relative shape of the line. No current price will be displayed. Superimposing the ‘shape’ of one series over a primary chart, is useful when rendering multiple series that do not share a common value range. - This setting will automatically override to true if 'isComparison' is set.
- This setting is only applicable when using the primary y-axis and has no effect when using a renderer that has its own axis.
marginTopnumber <optional>
0 Rendering Percentage (if less than 1) or pixels (if greater than 1) from top of panel to set the top margin for the series.
Note: this parameter is to be used on subsequent series rendered on the same axis. To set margins for the first series, CIQ.ChartEngine.YAxis#initialMarginTop needs to be used.
Note: not applicable if shareYAxis is set.marginBottomnumber <optional>
0 Rendering Percentage (if less than 1) or pixels (if greater than 1) from the bottom of panel to set the bottom margin for the series.
Note: this parameter is to be used on subsequent series rendered on the same axis. To set margins for the first series, CIQ.ChartEngine.YAxis#initialMarginBottom needs to be used.
Note: not applicable if shareYAxis is set.widthnumber <optional>
1 Rendering Width of line in pixels
minimumnumber <optional>
Rendering Minimum value for the series. Overrides CIQ.minMax result.
maximumnumber <optional>
Rendering Maximum value for the series. Overrides CIQ.minMax result.
colorstring <optional>
Rendering Color used to draw the series line. Causes the line to immediately render an overlay. Only applicable for default or single-color renderers.
Must be an RGB, RGBA, or three- or six‑digit hexadecimal color number or CSS color keyword; for example, "rgb(255, 0, 0)", "rgba(255, 0, 0, 0.5)", "#f00", "#FF0000", or "red".
See CIQ.Renderer#attachSeries for additional color options.
baseColorstring <optional>
parameters.color Rendering Color for the base of a mountain series.
patternarray | string <optional>
'solid' Rendering Pattern to draw line, array elements are pixels on and off, or a string e.g. "solid", "dotted", "dashed"
fillGapsboolean | string <optional>
Data Loading If CIQ.ChartEngine#cleanupGaps is enabled to clean gaps (not 'false'), you can use this parameter to override the global setting for this series.
- If
fillGapsnot present- No gaps will be filled for the series.
- If
fillGapsis set to 'false'- No gaps will be filled for the series.
- If
fillGapsis set to 'true',- Gap filling will match CIQ.ChartEngine#cleanupGaps.
- If
fillGapsis set to 'carry' or 'gap'- Will use that filling method even if
cleanupGapsis set differently.
- Will use that filling method even if
gapDisplayStyleobject | string <optional>
true Rendering Defines how (or if) to render (style) connecting lines where there are gaps in the data (missing data points), or isolated datapoints.
- Applicable for line-like renderers only (lines, mountains, baselines, etc).
- Default:
truefor standard series.falsefor comparisons.
- Set to
trueto use the color and pattern defined by CIQ.ChartEngine#setGapLines for the chart. - Set to
falseto always show gaps. - Set to an actual color string or custom color-pattern object as formatted by CIQ.ChartEngine#setGapLines to define more custom properties.
- 'Dots' indicating isolated items will be shown unless a
transparentcolor/style is specified. - If not set, and the series is a comparison, the gaps will always be rendered transparent.
fillStylestring <optional>
Rendering Fill style for mountain chart (if selected). For semi-opaque use rgba(R,G,B,.1). If not provided a gradient is created with color and baseColor.
permanentboolean <optional>
false Rendering Set to
trueto activate. Makes series unremoveable by a user when attached to the default renderer. If explicitly linked to a renderer, see CIQ.Renderer#attachSeries for details on how to prevent an attached series from being removed by a user.dataobject <optional>
Data Loading Data source for the series. If this field is omitted, the library will connect to the QuoteFeed (if available) to fetch initial data ( unless
parameters.loadDatais set tofalse), and manage pagination and updates. If data is sent in this field, it will be loaded into the masterData, but series will not be managed by the QuoteFeed (if available) for pagination or updates. Items in this array must be ordered from earliest to latest date.
Accepted formats:
Full OHLC:
An array of properly formatted OHLC quote object(s). See OHLC Data Format.
----
Price Only:
An array of objects, each one with the following elements:Properties
Name Type Argument Description DTdate <optional>
JavaScript date object or epoch representing data point (overrides Date parameter if present)
Datestring <optional>
string date representing data point ( only used if DT parameter is not present)
Valuenumber <optional>
value of the data point ( As an alternative, you can send
parameters.data.Closesince your quote feed may already be returning the data using this element name)Closenumber <optional>
value of the data point ( Used as an alternative to
parameters.data.Value)panelstring | boolean <optional>
Rendering The panel name on which the series should display. If the panel doesn't exist, one will be created. If
trueis passed, a new panel will also be created.
Note: Histogram is the default renderer and is always placed in the main panel. Therefore, the panel property does not apply to Histogram renderers.actionstring <optional>
'add-series' Rendering Overrides what action is sent in symbolChange events. Set to null to prevent a symbolChange event.
loadDataboolean <optional>
true Data Loading Include and set to false if you know the initial data is already in the masterData array or will be loaded by another method. The series will be added but no data requested. Note that if you remove this series, the data points linked to it will also be removed which may create issues if required by the chart. If that is the case, you will need to manually remove from the renderer linked to it instead of the underlying series itself.
extendToEndOfDataSetboolean <optional>
Rendering Set to true to plot any gap at the front of the chart. Automatically done for step charts (set to false to disable) or if parameters.gapDisplayStyle are set (see CIQ.ChartEngine#addSeries)
displayFloatingLabelboolean <optional>
false Rendering Set to false to disable the display of a y-axisfloating label for this series.
baselineboolean | object <optional>
Rendering If a boolean value, indicates whether the series renderer draws a baseline. If an object, must be the equivalent of CIQ.ChartEngine.Chart#baseline.
responseHandlerfunction <optional>
Optional function to override the processing of data. Function accepts an object argument with
symbolandsymbolObjectproperties. If omitted, uses a default implementation.retoggleboolean <optional>
Set to true to indicate that series should be reloaded when loading a new chart.
processResultsfunction <optional>
Optional function to perform on the returned result set. Function accepts arguments (stx, error, series, data). Called within responseHandler function.
takedownResultsfunction <optional>
Optional function to perform when removing series. Complements
processResults. Function accepts arguments (stx, seriesId).stretchGapsboolean <optional>
Set to true to cause gaps to be represented by a horizontal line.
noStorageboolean <optional>
Set to true to disable export of the series when saving layout.
periodicParamsobject <optional>
Set to indicate that quote feed supplied data is periodic and needs to be expanded for given range.
Properties
Name Type Argument Default Description endOfPeriodboolean <optional>
Set to indicate periodic data Date property is at the end of period insted of default beginning.
periodstring <optional>
"quarter" Span period defaults to quarter.
labelsobject <optional>
Draw labels when set for histogram and line renderers
Properties
Name Type Argument Default Description backgroundColorstring <optional>
Label background color override
textColorstring <optional>
Label text color override
fontstring <optional>
"12px Arial" Label font override
boldboolean <optional>
Whether the font should be bold
italicboolean <optional>
Whether the font should be italic
paddingnumber <optional>
Label padding override
verticalOffsetnumber <optional>
Label vertical offset override
insideBarboolean <optional>
Whether to draw labels inside histogram bars
lastVisibleOnlyboolean <optional>
Draw only the last visible label
cbfunction <optional>
Callback function to be executed once the fetch returns data from the quoteFeed. It will be called with an error message if the fetch failed:
cb(err);. Only applicable if no data is provided.- Since:
-
9.7.0
-
clear(cb)
-
Clears chart and series manager state
Parameters:
Name Type Description cbfunction Callback on data cleared
- Since:
-
9.7.0
-
getHistogram(period)
-
Returns and creates if necessary histogram renderer for a given periodicity
Parameters:
Name Type Default Description periodstring quarterly Histogram period.
- Since:
-
9.7.0
Returns:
Histogram renderer for period
-
loadSeriesInfo()
-
Retrives series info from the chart and stores it internaly
- Since:
-
9.7.0
-
modify(id, parameters)
-
Wrapper function for chart engine modify series
Parameters:
Name Type Description idstring Series to modify.
parametersobject The parameters to change or add.
Returns:
True if series is found and modified
- Type
- boolean
-
primaryIsNotEmpty()
-
Returns true if the chart primary series is not empty
- Since:
-
9.7.0
Returns:
true if primary series is not empty
- Type
- boolean
-
remove( [ids])
-
Wrapper function for chart engine removeSeries method.
Parameters:
Name Type Argument Description idsArray.<string> <optional>
<repeatable>
Ids of series to remove
- Since:
-
9.7.0
-
updateRange()
-
Updates chart visible range to view all loaded data
- Since:
-
9.7.0
-
updateSettings(cb)
-
Updates chart settings periodicity, y-axis visiblity and grid lines and x axis labels based on periodicities of series available in the chart
Parameters:
Name Type Description cbfunction Callback invoked on periodicity change
- Since:
-
9.7.0
