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
cfgobject chart configuration
on
Subscribe to a topic
Parameters
topicString The topic namehandlerFunction The function or method that is calledcontextObject The context the function(s) belongs to
off
Unsubscribe from a topic
Parameters
emit
Publish an topic
Parameters
execute
Execute a task
Parameters
channeldataObject The data that gets publishedcbFunction callback methodtopicString 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
posarray [x2, y2, x1, y1, xdelta, ydelta]
isIndicator
validate indicator
Parameters
iclass indicator class
setIndicators
import Indicators
Parameters
iobject indicators {id, name, event, ind}flushboolean expunge default indicators (optional, defaultfalse)
Returns any boolean
addIndicator
add an indicator - default or registered user defined
Parameters
istring indicatornamestring identifier (optional, defaulti)paramsobject {settings, data} (optional, default{})
Returns (Indicator | false) indicator instance or false
getIndicator
retrieve indicator by ID
Parameters
istring 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
txCfgobject chart config (optional, default{})containerDOM_element HTML element to mount the chart onstateobject chart state
Returns instance
destroy
Destroy a chart instance, clean up and remove data
Parameters
chartinstance
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
pricePrecisionnumber Price accuracy
setVolumePrecision
Set the volume accuracy
Parameters
volumePrecisionnumber Volume accuracy
addTheme
Add a theme to the chart, if no current theme is set, make this the current one.
Parameters
themeobject Volume accuracy
Returns instance theme instance
setTheme
Set the chart theme
Parameters
IDthemestring theme identifier
setStream
specify a chart stream
Parameters
streamobject
Returns instance
getRange
initialize range
Parameters
startnumber index (optional, default0)endnumber 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
mergeobject 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