core - documentation.js
Table of Contents
- TradeXchart
- start
- on
- off
- emit
- execute
- delayedSetRange
- updateRange
- isIndicator
- setIndicators
- addIndicator
- getIndicator
- removeIndicator
- indicatorSettings
- hasStateIndicator
- create
- destroy
- destroy
- setDimensions
- setPricePrecision
- setVolumePrecision
- addTheme
- setTheme
- setStream
- getRange
- setRange
- mergeData
- resize
- refresh
TradeXchart
The root class for the entire chart
start
Target element has been validated as a mount point, let’s start building
Parameters
cfg
object chart configuration
on
Subscribe to a topic
Parameters
topic
String The topic namehandler
Function The function or method that is calledcontext
Object The context the function(s) belongs to
off
Unsubscribe from a topic
Parameters
emit
Publish an topic
Parameters
execute
Execute a task
Parameters
channel
data
Object The data that gets publishedcb
Function callback methodtopic
String The topic name
delayedSetRange
When chart is empty postpone range setting until first candle, then position on last
updateRange
Calculate new range index / position from position difference typically mouse drag or cursor keys
Parameters
pos
array [x2, y2, x1, y1, xdelta, ydelta]
isIndicator
validate indicator
Parameters
i
class indicator class
setIndicators
import Indicators
Parameters
i
object indicators {id, name, event, ind}flush
boolean expunge default indicators (optional, defaultfalse
)
Returns any boolean
addIndicator
add an indicator - default or registered user defined
Parameters
i
string indicatorname
string identifier (optional, defaulti
)params
object {settings, data} (optional, default{}
)
Returns (Indicator | false
) indicator instance or false
getIndicator
retrieve indicator by ID
Parameters
i
string indicator ID
removeIndicator
remove an indicator - default or registered user defined
Parameters
i
(string | Indicator) indicator id or Indicator instance
Returns boolean success / failure
indicatorSettings
set or get indicator settings
Parameters
Returns boolean success / failure
hasStateIndicator
Does current chart state have indicator
Parameters
Returns any indicator or false
create
Create a new TradeXchart instance
Parameters
txCfg
object chart config (optional, default{}
)container
DOM_element HTML element to mount the chart onstate
object chart state
Returns instance
destroy
Destroy a chart instance, clean up and remove data
Parameters
chart
instance
destroy
Stop all chart event processing and remove the chart from DOM. In other words, destroy the chart.
setDimensions
Set chart width and height
Parameters
setPricePrecision
Set the price accuracy
Parameters
pricePrecision
number Price accuracy
setVolumePrecision
Set the volume accuracy
Parameters
volumePrecision
number Volume accuracy
addTheme
Add a theme to the chart, if no current theme is set, make this the current one.
Parameters
theme
object Volume accuracy
Returns instance theme instance
setTheme
Set the chart theme
Parameters
ID
theme
string theme identifier
setStream
specify a chart stream
Parameters
stream
object
Returns instance
getRange
initialize range
Parameters
start
number index (optional, default0
)end
number index (optional, default0
)config
(optional, default{}
)
setRange
set start and end of range
Parameters
mergeData
Merge a block of data into the chart state. Used for populating a chart with back history. Merge data must be formatted to a Chart State. Optionally set a new range upon merge.
Parameters
merge
object merge data must be formatted to a Chart StatenewRange
(boolean | object) false | {start: number, end: number} (optional, defaultfalse
)calc
(optional, defaulttrue
)
resize
Resize the chart
Parameters
Returns boolean success or failure
refresh
refresh / redraw the chart