Constructor
(abstract) new module:caplin/chart/Study(alias, derivationParams, listener, configOverridesopt)
Parameters:
Name | Type | Attributes | Description | |||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
alias |
String | The Study alias. | ||||||||||||||||||||||||||||||||||||||||||||||
derivationParams |
Object | Options that the study will use to determine how to calculate the study series
data. This will usually be at least period . |
||||||||||||||||||||||||||||||||||||||||||||||
listener |
Object | A listener object that implements the module:caplin/chart/study/StudyListener interface. |
||||||||||||||||||||||||||||||||||||||||||||||
configOverrides |
Object |
<optional> |
The configuration options for the study.
Properties
|
Methods
-
enqueue(data, idx, 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.
Parameters:
Name Type Description data
Array The latest value array from the Study. idx
Number The current values index within the studies current data set. arr
Array The data that the Study is currently evaluating. -
evaluate(data)
-
This method will get called by the
module:caplin/chart/Series
every time it receives new chart data. This method should perform its calculations and then pass the calculated data to the listenersonStudyData
method. Seemodule:caplin/chart/SeriesListener
.Parameters:
Name Type Description data
Array Chart series data in the Caplin Format. -
getAlias() → {String}
-
Gets the alias name of the study.
The alias name is used to identify the study when deserialising the persisted form.
Returns:
The alias for the Study.- Type
- String
-
getColor() → {String|null}
-
- Deprecated:
- Use
module:caplin/chart/Study#getColors
instead. Returns the colour that was set for this study. By default this is null.
- Use
Returns:
The colour of the study.- Type
- String | null
-
getColors() → {Array}
-
Returns a list of colours for each series this study outputs.
Returns:
List of colours for each study series.- Type
- Array
-
getConfigValue(key)
-
Gets a specific Study configuration option.
Parameters:
Name Type Description key
String The configuration option key. Returns:
The configuration option value. -
getDerivationParam(key)
-
Gets a specific Study derivation option.
Parameters:
Name Type Description key
String The option key. Returns:
The derivation option value. -
getDerivationParams() → {Object}
-
Gets the derivation options of the study.
Returns:
The options.- Type
- Object
-
getDisplayName(seriesIdxopt) → {String}
-
Gets the display name of the series, derived from the alias and configuration parameters.
Parameters:
Name Type Attributes Description seriesIdx
Number <optional>
The index of the series. Returns:
The internationalised display name.- Type
- String
-
getId() → {String}
-
Get the ID of this study.
The ID is constructed from the study type and derivation options.
Returns:
The ID of this study.- Type
- String
-
getRepresentationNames() → {Array}
-
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).
Returns:
The list of series names within a study.- Type
- Array
-
getRepresentationTypes() → {Array}
-
Gets the representation types of the data that the study returns (line, spline, ...).
This is used by the
module:caplin/chart/Chart
to determine how to display the study data.Returns:
Style of the study data.- Type
- Array
-
serialize() → {String}
-
Returns the serialised state of the study. The serialisation logic is handled by the
module:caplin/chart/Series
so you don't have to call this method manually.Returns:
The XML representation of the object.- Type
- String