The Study class accepts, as its last argument, a map of overrides for configuration options for the descendant
study. These options can be overridden in two places. The Study
defines the sensible defaults. The
first place where the configuration options can be overridden is in the descendant study's constructor when it
calls the parent constructor. The second place is when you create a new instance of a study (either using the
caplin.chart.study.Factory or caplin.chart.Series#addStudy). A descendant must pass the user's
override up to the Study
.
The table below explains each possible configuration option.
name | default | type | description |
---|---|---|---|
batchSize | 100 | Number | How many study series points should be sent to the listener at once. |
representationTypes | ['spline'] | Array | What type of, and how many, series will this study output. |
representationNames | [''] | Array | The logical name for each outputted study series. This will only be used by studies that output more than one series. |
i18nPrefix | ct.analysis.study. | String | The i18n key prefix used by the `getDisplayName`. |
isolated | false | Boolean | Should the chart component represent this study on a different panel. |
serialize | true | Boolean | Should this study be serialised. |
color | null | String |
This configuration option has been deprecated, use `colors` instead. The colour for the study series that should be used by the chart component. |
colors | [null] | Array | The list of colours for the study series that should be used by the chart component. |
Attributes | Name and Description |
---|---|
|
caplin.chart.Study(String alias, Object derivationParams, Object listener, Object configOverrides)
Provides initial initialisation of the Study. |
Attributes | Name and Description |
---|---|
|
void
enqueue(Array data, Number idx, Array arr)
Enqueues processed study data, which is then batch forwarded to the listener. |
|
void
evaluate(Array data)
This method will get called by the caplin.chart.Series every time it receives new chart data. |
|
String
getAlias()
Gets the alias name of the study. |
|
String|null
getColor()
|
|
Array
getColors()
Returns a list of colours for each series this study outputs. |
|
void
getConfigValue(String key)
Gets a specific Study configuration option. |
|
void
getDerivationParam(String key)
Gets a specific Study derivation option. |
|
Object
getDerivationParams()
Gets the derivation options of the study. |
|
String
getDisplayName(Number seriesIdx)
Gets the display name of the series, derived from the alias and configuration parameters. |
|
String
getId()
Get the ID of this study. |
|
Array
getRepresentationNames()
Gets the representation names for individual series generated by the study. |
|
Array
getRepresentationTypes()
Gets the representation types of the data that the study returns (line, spline, . |
|
String
serialize()
Returns the serialised state of the study. |
►
caplin.chart.Study(String alias, Object derivationParams, Object listener, Object configOverrides)
Provides initial initialisation of the Study. Concrete studies must extend this abstract class and call this
constructor (caplin.chart.Study.call(this, alias, derivationParams, listener, configOverrides);
).
String | alias | The Study alias. |
Object | derivationParams | Options that the study will use to determine how to calculate the study series
data. This will usually be at least period . |
Object | listener | A listener object that implements the caplin.chart.study.StudyListener interface. |
Object | configOverrides | (optional) The configuration options for the study. See the Study
description for details. |
►
void
enqueue(Array data, Number idx, Array arr)
Enqueues processed study data, which is then batch forwarded to the listener.
Performance optimisation for older browsers.
This method is only to be called by the Study by methods #evaluate or #onStudyData.
Array | data | The latest value array from the Study. |
Number | idx | The current values index within the studies current data set. |
Array | arr | The data that the Study is currently evaluating. |
►
void
evaluate(Array data)
This method will get called by the caplin.chart.Series every time it receives new chart data. This method
should perform its calculations and then pass the calculated data to the listeners onStudyData
method. See caplin.chart.SeriesListener.
Array | data | Chart series data in the Caplin Format. |
►
String
getAlias()
Gets the alias name of the study.
The alias name is used to identify the study when deserialising the persisted form.
►
String|null
getColor()
►
Array
getColors()
Returns a list of colours for each series this study outputs.
►
void
getConfigValue(String key)
Gets a specific Study configuration option.
String | key | The configuration option key. |
►
void
getDerivationParam(String key)
Gets a specific Study derivation option.
String | key | The option key. |
►
Object
getDerivationParams()
Gets the derivation options of the study.
►
String
getDisplayName(Number seriesIdx)
Gets the display name of the series, derived from the alias and configuration parameters.
Number | seriesIdx | (optional) The index of the series. |
►
String
getId()
Get the ID of this study.
The ID is constructed from the study type and derivation options.
►
Array
getRepresentationNames()
Gets the representation names for individual series generated by the study. This exists for studies that return more than one series (such as the Bollinger band).
►
Array
getRepresentationTypes()
Gets the representation types of the data that the study returns (line, spline, ...).
This is used by the caplin.chart.Chart to determine how to display the study data.
►
String
serialize()
Returns the serialised state of the study. The serialisation logic is handled by the caplin.chart.Series so you don't have to call this method manually.