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 id
string 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.)
parameters
object <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 renderer
string <optional>
CIQ.Renderer.Lines Rendering Set to the desired renderer for the series.
- If not set, defaults to Histogram
name
string <optional>
Rendering Set to specify renderer's name. Otherwise,
id
will be used.display
string <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.
symbol
string <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
id
as the symbol. If bothsymbol
andsymbolObject
are set,symbolObject
will be used.symbolObject
object <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
id
as the symbol. You can send anything you want in the symbol object, but you must always include at least a 'symbol' element. If bothsymbol
andsymbolObject
are set,symbolObject
will be used.field
string <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.
isComparison
boolean <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.shareYAxis
boolean <optional>
false Rendering
- Set to
true
so 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.
marginTop
number <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.marginBottom
number <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.width
number <optional>
1 Rendering Width of line in pixels
minimum
number <optional>
Rendering Minimum value for the series. Overrides CIQ.minMax result.
maximum
number <optional>
Rendering Maximum value for the series. Overrides CIQ.minMax result.
color
string <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.
baseColor
string <optional>
parameters.color Rendering Color for the base of a mountain series.
pattern
array | string <optional>
'solid' Rendering Pattern to draw line, array elements are pixels on and off, or a string e.g. "solid", "dotted", "dashed"
fillGaps
boolean | 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
fillGaps
not present- No gaps will be filled for the series.
- If
fillGaps
is set to 'false'- No gaps will be filled for the series.
- If
fillGaps
is set to 'true',- Gap filling will match CIQ.ChartEngine#cleanupGaps.
- If
fillGaps
is set to 'carry' or 'gap'- Will use that filling method even if
cleanupGaps
is set differently.
- Will use that filling method even if
gapDisplayStyle
object | 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:
true
for standard series.false
for comparisons.
- Set to
true
to use the color and pattern defined by CIQ.ChartEngine#setGapLines for the chart. - Set to
false
to 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
transparent
color/style is specified. - If not set, and the series is a comparison, the gaps will always be rendered transparent.
fillStyle
string <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.
permanent
boolean <optional>
false Rendering Set to
true
to 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.data
object <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.loadData
is 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 DT
date <optional>
JavaScript date object or epoch representing data point (overrides Date parameter if present)
Date
string <optional>
string date representing data point ( only used if DT parameter is not present)
Value
number <optional>
value of the data point ( As an alternative, you can send
parameters.data.Close
since your quote feed may already be returning the data using this element name)Close
number <optional>
value of the data point ( Used as an alternative to
parameters.data.Value
)panel
string | boolean <optional>
Rendering The panel name on which the series should display. If the panel doesn't exist, one will be created. If
true
is passed, a new panel will also be created.action
string <optional>
'add-series' Rendering Overrides what action is sent in symbolChange events. Set to null to prevent a symbolChange event.
loadData
boolean <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.
extendToEndOfDataSet
boolean <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)
displayFloatingLabel
boolean <optional>
false Rendering Set to false to disable the display of a y-axisfloating label for this series.
baseline
boolean | 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.
responseHandler
function <optional>
Optional function to override the processing of data. Function accepts an object argument with
symbol
andsymbolObject
properties. If omitted, uses a default implementation.retoggle
boolean <optional>
Set to true to indicate that series should be reloaded when loading a new chart.
processResults
function <optional>
Optional function to perform on the returned result set. Function accepts arguments (stx, error, series, data). Called within responseHandler function.
takedownResults
function <optional>
Optional function to perform when removing series. Complements
processResults
. Function accepts arguments (stx, seriesId).stretchGaps
boolean <optional>
Set to true to cause gaps to be represented by a horizontal line.
noStorage
boolean <optional>
Set to true to disable export of the series when saving layout.
periodicParams
object <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 endOfPeriod
boolean <optional>
Set to indicate periodic data Date property is at the end of period insted of default beginning.
period
string <optional>
"quarter" Span period defaults to quarter.
labels
object <optional>
Draw labels when set for histogram and line renderers
Properties
Name Type Argument Default Description backgroundColor
string <optional>
Label background color override
textColor
string <optional>
Label text color override
font
string <optional>
"12px Arial" Label font override
bold
boolean <optional>
Whether the font should be bold
italic
boolean <optional>
Whether the font should be italic
padding
number <optional>
Label padding override
verticalOffset
number <optional>
Label vertical offset override
insideBar
boolean <optional>
Whether to draw labels inside histogram bars
lastVisibleOnly
boolean <optional>
Draw only the last visible label
cb
function <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 cb
function 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 period
string 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 id
string Series to modify.
parameters
object 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 ids
Array.<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 cb
function Callback invoked on periodicity change
- Since:
-
9.7.0