Study Api - thaokv/stv GitHub Wiki
Study API
isUserEditEnabled()
Returns true
if a user is able to remove/change/hide the study.
setUserEditEnabled(enabled)
enabled
-true
orfalse
Enables or disables removing/changing/hiding a study by the user.
getInputsInfo()
Returns the information about all the inputs - an array of StudyInputInfo objects.
getInputValues()
Returns values of study inputs - an array of StudyInputValueItem objects.
setInputValues(inputs)
inputs
should be an array of StudyInputValueItem objects.
Sets input values for a study. It may contain only some of the inputs that you wish to change.
getStyleInfo()
Returns the information about all the properties contained in Style tab - an array of StudyStyleInfo objects.
getStyleValues()
Returns values of style properties - an array of StudyStyleValues objects.
mergeUp()
Merges the study up (if possible).
mergeDown()
Merges the study down (if possible).
unmergeUp()
Unmerges the study up (if possible).
unmergeDown()
Unmerges the study down (if possible).
changePriceScale(priceScale)
priceScale
should be a string with one of the following values:"new-left"
- attach the study to the new left price scale"new-right"
- attach the study to the new right price scale"no-scale"
- do not attach the study to any price scale if there are another price scales on the pane. The study will be added in 'No Scale' mode"as-series"
- attach the study to the price scale where the main series is attached (it is only applicable if the study and the main series are located on the same pane)entityId
- attach the study to the same price axis as a study with a correspondingentityId
Changes the price scale of the study. See here more information about panes and scales behavior in relation to studies.
isVisible()
Returns true
if the study is visible.
setVisible(value)
value
-true
orfalse
Shows/hides the study.
bringToFront()
Places the study on top of all other chart objects.
sendToBack()
Places the study behind all other chart objects.
applyOverrides(overrides)
overrides
- new overrides for the study
Applies overrides
to the study.
Note: overrides
object keys don’t need to start with the study name. The key is applied to a particular study.
For example, you should use style
instead of Overlay.style
to override the current style of the Overlay study.
onDataLoaded
You can subscribe using Subscription object returned by this function to be notified when the study data is loaded. You can also use the same object to unsubscribe from the event.
Example:
studyApi.onDataLoaded().subscribe(
null,
() => console.log('Study data is loaded'),
true
);
onStudyError
You can subscribe using Subscription object returned by this function to be notified when the study received an error. You can also use the same object to unsubscribe from the event.
Example:
studyApi.onStudyError().subscribe(
null,
() => console.log('Study error'),
true
);
:chart: applyToEntireLayout()
Copies the study to all charts of the layout.
Primitive types
StudyInputInfo
An object with the following keys:
id
- input ID of the studyname
- name of the inputtype
- type of the inputlocalizedName
- name of the input translated to the current language
StudyInputValueItem
An object with the following keys:
id
- input ID of the studyvalue
- value of the input
StudyStyleInfo
An object with the following keys (short decription). More details can be found here:
defaults
- optional property - an object containing settings that are applied when user clicksApply Defaults
plots
- optional property - an array with study plots infostyles
- optional property - an object withplot id
as keys and style info as valuesbands
- optional property - an array with study band info objectsfilledAreas
- optional property - an array of filled areas info. Filled area is a special object, which allows coloring an area between two plotspalettes
- optional property - an object with the definitions of palletes that are used inplots
anddefaults
StudyStyleValues
Same object as StudyStyleInfo without the default
property.