The Study class accepts, as it's last argument, a map of configuration options overrides for the descendant
study. This 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 kind of, and how many of, 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 serialized. |
color | null | String | The colour for the study series that should be used by the chart component. |
Attributes | Name and Description |
---|---|
|
caplin.chart.Study(String sAlias, Object mDerivationParams, Object oListener, Object mConfigOverrides)
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 pData)
This method will get called by the caplin.chart.Series every time it will get new chart data. |
|
String
getAlias()
Gets the study's alias name. |
|
String|null
getColor()
Returns the colour that was set for this study. |
|
void
getConfigValue(String sKey)
Gets a specific Study configuration option. |
|
void
getDerivationParam(String sKey)
Gets a specific Study derivation option. |
|
Object
getDerivationParams()
Gets the Study's derivation options. |
|
String
getDisplayName(Number nSeriesIdx)
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 sAlias, Object mDerivationParams, Object oListener, Object mConfigOverrides)
Provides initial initialisation of the Study. Concrete studies must extend this abstract class and call this
constructor (caplin.chart.Study.call(this, sAlias, mDerivationParams, oListener, mConfigOverrides);
).
String | sAlias | The Study alias. |
Object | mDerivationParams | Options that the study will use to determine how to calculate the study series
data. This will usually be at leas period . |
Object | oListener | A listener object that implements the caplin.chart.study.StudyListener interface. |
Object | mConfigOverrides | (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 value's index within the studies current data set. |
Array | arr | The data that the Study is currently evaluating. |
►
void
evaluate(Array pData)
This method will get called by the caplin.chart.Series every time it will get new chart data. This method
should perform it's calculations and then pass the calculated data to the listeners onStudyData
method. See caplin.chart.SeriesListener.
Array | pData | Chart series data in the Caplin Format. |
►
String
getAlias()
Gets the study's alias name.
The alias name is used to identify the study when deserialising the persisted form.
►
String|null
getColor()
Returns the colour that was set for this study. By default this is null.
►
void
getConfigValue(String sKey)
Gets a specific Study configuration option.
String | sKey | The configuration option key. |
►
void
getDerivationParam(String sKey)
Gets a specific Study derivation option.
String | sKey | The option key. |
►
Object
getDerivationParams()
Gets the Study's derivation options.
►
String
getDisplayName(Number nSeriesIdx)
Gets the display name of the series, derived from the alias and configuration parameters.
Number | nSeriesIdx | (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.