_options
& _listener
).
The constructor will also initialise three member
variables (_representationTypes
,
_representationNames
& _name
)
for which studies must provide values as they are
used in the getId
& getRepresentationType
methods.
Each study accepts two arguments:
name | description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
mOptions |
A map of options that the study needs to work.
|
|||||||||
oListener | Object that will receive updates from the study when it has evaluated the data. This will be the caplin.chart.Series object in most cases but it can also be another study, as some studies will use other study data to evaluate their own (Bollinger band, for instance, uses the simple moving average). The listener must implement the caplin.chart.SeriesListener interface. | |||||||||
oEmitter | An optional object to relay data to the listener. |
To use a study you add it to the caplin.chart.Series object wit the caplin.chart.Series#addStudy method.
Attributes | Name and Description |
---|---|
|
caplin.chart.Study(Object mOptions, Object oListener, Object oEmitter)
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 Performance optimisation for older browsers This method is only to be called by the Study by methods #evaluate or #onStudyData |
|
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 The alias name is used to identify the study when deserializing the persisted form |
|
Object
getConfiguration()
Get the configuration options for the study. |
|
String
getDisplayName( seriesIdx)
Gets the display name, derived from the name and option 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, . |
►
caplin.chart.Study(Object mOptions, Object oListener, Object oEmitter)
Provides initial initialisation of the Study. Concrete
studies must extend this abstract class and call this
constructor
(caplin.chart.Study.call(this, mOptions, oListener);
).
Object | mOptions | Study options |
Object | oListener | The listener for study data |
Object | oEmitter | An optional emitter override |
►
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 deserializing the persisted form
►
Object
getConfiguration()
Get the configuration options for the study.
►
String
getDisplayName( seriesIdx)
Gets the display name, derived from the name and option parameters.
seriesIdx |
►
String
getId()
Get the ID of this study.
The ID is constructed from the study type and configuration 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.