core
Classes
- TradeXchart ⇐
Tradex_chart
Members
- version ⇒
string
- name ⇒
string
- shortName ⇒
string
- config ⇒
object
- Chart ⇒
object
- ChartPanes ⇒
Map
- Indicators ⇒
object
- state ⇒
State
- allData ⇒
object
Functions
- start(cfg)
Target element has been validated as a mount point, let's start building
- on(topic, handler, context) ⇒
boolean
Subscribe to a topic
- off(topic, handler) ⇒
boolean
Unsubscribe from a topic
- emit(topic, data) ⇒
boolean
Publish a topic
- execute(topic, data, cb)
Execute a task
- stopStream()
stop a chart stream will halt any updates to price or indicators
- jumpToIndex(start, nearest, centre)
set Range start index
- jumpToTS(ts, nearest, centre)
set Range start to time stamp
- jumpToStart(centre)
set Range start to state data start
- jumpToEnd(centre)
set Range start to state data end
- mergeData(merge, newRange)
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.
- isIndicator(i) ⇒
boolean
validate indicator
- setIndicators(i, flush) ⇒
boolean
import Indicators
- addIndicator(i, name, params) ⇒
Indicator
|false
add an indicator - default or registered user defined
- getIndicator(i) ⇒
Indicator
|false
retrieve indicator by ID
- removeIndicator(i) ⇒
boolean
remove an indicator - default or registered user defined
- indicatorSettings(i, s) ⇒
Object
set or get indicator settings
- hasStateIndicator(i, dataset) ⇒
Indicator
|false
Does current chart state have indicator
- calcAllIndicators()
calculate all indicators currently in use
TradeXchart ⇐ Tradex_chart
Kind: global class
Extends: Tradex_chart
- TradeXchart ⇐
Tradex_chart
- new TradeXchart()
- .create(container, [txCfg], state) ⇒
instance
- .destroy(chart)
- .destroy()
- .setDimensions(w, h)
- .setPricePrecision(pricePrecision)
- .setVolumePrecision(volumePrecision)
- .addTheme(theme) ⇒
instance
- .setTheme(theme) ⇒
boolean
- .setStream(stream) ⇒
instance
- .getRange(start, end)
- .setRange(start, end)
- .resize(width, height) ⇒
boolean
- .refresh()
new TradeXchart()
The root class for the entire chart
TradeXchart.create(container, [txCfg], state) ⇒ instance
Create a new TradeXchart instance
Kind: static method of TradeXchart
Returns: instance
- TradeXchart
Param | Type | Default | Description |
---|---|---|---|
container | DOM_element | HTML element to mount the chart on | |
[txCfg] | Object | {} | chart config |
state | Object | chart state |
TradeXchart.destroy(chart)
Destroy a chart instance, clean up and remove data
Kind: static method of TradeXchart
Param | Type |
---|---|
chart | instance |
TradeXchart.destroy()
Stop all chart event processing and remove the chart from DOM. In other words, destroy the chart.
Kind: static method of TradeXchart
TradeXchart.setDimensions(w, h)
Set chart width and height
Kind: static method of TradeXchart
Param | Type | Description |
---|---|---|
w | number | width in pixels |
h | number | height in pixels |
TradeXchart.setPricePrecision(pricePrecision)
Set the price accuracy
Kind: static method of TradeXchart
Param | Type | Description |
---|---|---|
pricePrecision | number | Price accuracy |
TradeXchart.setVolumePrecision(volumePrecision)
Set the volume accuracy
Kind: static method of TradeXchart
Param | Type | Description |
---|---|---|
volumePrecision | number | Volume accuracy |
TradeXchart.addTheme(theme) ⇒ instance
Add a theme to the chart, if no current theme is set, make this the current one.
Kind: static method of TradeXchart
Returns: instance
- - theme instance
Param | Type | Description |
---|---|---|
theme | Object | Volume accuracy |
TradeXchart.setTheme(theme) ⇒ boolean
Set the chart theme
Kind: static method of TradeXchart
Param | Type | Description |
---|---|---|
theme | string | theme identifier |
TradeXchart.setStream(stream) ⇒ instance
specify a chart stream
Kind: static method of TradeXchart
Param | Type |
---|---|
stream | Object |
TradeXchart.getRange(start, end)
initialize range
Kind: static method of TradeXchart
Param | Type | Default | Description |
---|---|---|---|
start | number | 0 | index |
end | number | 0 | index |
TradeXchart.setRange(start, end)
set start and end of range
Kind: static method of TradeXchart
Param | Type | Default | Description |
---|---|---|---|
start | number | 0 | index |
end | number | index |
TradeXchart.resize(width, height) ⇒ boolean
Resize the chart
Kind: static method of TradeXchart
Returns: boolean
- - success or failure
Param | Type | Description |
---|---|---|
width | number | pixels |
height | number | pixels |
TradeXchart.refresh()
refresh / redraw the chart
Kind: static method of TradeXchart
version ⇒ string
Kind: global variable
Returns: string
- - return TradeX Chart version number
name ⇒ string
Kind: global variable
Returns: string
- - user defined chart name
shortName ⇒ string
Kind: global variable
Returns: string
- - user defined short chart name
config ⇒ object
Kind: global variable
Returns: object
- - current chart configuration including defaults
Chart ⇒ object
Kind: global variable
Returns: object
- - primary chart pane - displays price history (candles)
ChartPanes ⇒ Map
Kind: global variable
Returns: Map
- - all chart panes, primary and secondary
Indicators ⇒ object
Kind: global variable
Returns: object
- - all chart indicators in use, grouped by chart panes
state ⇒ State
Kind: global variable
Returns: State
- - current state instance
allData ⇒ object
Kind: global variable
Returns: object
- - all state datasets
start(cfg)
Target element has been validated as a mount point, let’s start building
Kind: global function
Param | Type | Description |
---|---|---|
cfg | Object | chart configuration |
on(topic, handler, context) ⇒ boolean
Subscribe to a topic
Kind: global function
Param | Type | Description |
---|---|---|
topic | string | The topic name |
handler | function | The function or method that is called |
context | Object | The context the function(s) belongs to |
off(topic, handler) ⇒ boolean
Unsubscribe from a topic
Kind: global function
Param | Type | Description |
---|---|---|
topic | string | The topic name |
handler | function | function to remove |
emit(topic, data) ⇒ boolean
Publish a topic
Kind: global function
Param | Type | Description |
---|---|---|
topic | string | The topic name |
data | Object | The data to publish |
execute(topic, data, cb)
Execute a task
Kind: global function
Param | Type | Description |
---|---|---|
topic | string | The topic name |
data | Object | The data that gets published |
cb | function | callback method |
stopStream()
stop a chart stream will halt any updates to price or indicators
jumpToIndex(start, nearest, centre)
set Range start index
Kind: global function
Param | Type | Default | Description |
---|---|---|---|
start | number | starting index of state data | |
nearest | boolean | true | limit range start - no out of range values |
centre | boolean | true | center the range on the start value |
jumpToTS(ts, nearest, centre)
set Range start to time stamp
Kind: global function
Param | Type | Default | Description |
---|---|---|---|
ts | number | timestamp | |
nearest | boolean | true | limit range start - no out of range values |
centre | boolean | true | center the range on the start value |
jumpToStart(centre)
set Range start to state data start
Kind: global function
Param | Type | Default | Description |
---|---|---|---|
centre | boolean | true | center the range on the start value |
jumpToEnd(centre)
set Range start to state data end
Kind: global function
Param | Type | Default | Description |
---|---|---|---|
centre | boolean | true | center the range on the end value |
mergeData(merge, newRange)
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.
Kind: global function
Param | Type | Default | Description |
---|---|---|---|
merge | Object | merge data must be formatted to a Chart State | |
newRange | boolean | object | false | false |
isIndicator(i) ⇒ boolean
validate indicator
Kind: global function
Param | Type | Description |
---|---|---|
i | class | indicator class |
setIndicators(i, flush) ⇒ boolean
import Indicators
Kind: global function
Param | Type | Default | Description |
---|---|---|---|
i | Object | indicators {id, name, event, ind} | |
flush | boolean | false | expunge default indicators |
addIndicator(i, name, params) ⇒ Indicator
| false
add an indicator - default or registered user defined
Kind: global function
Returns: Indicator
| false
- - indicator instance or false
Param | Type | Description |
---|---|---|
i | string | indicator |
name | string | identifier |
params | Object | {settings, data} |
getIndicator(i) ⇒ Indicator
| false
retrieve indicator by ID
Kind: global function
Returns: Indicator
| false
- - indicator instance or false
Param | Type | Description |
---|---|---|
i | string | indicator ID |
removeIndicator(i) ⇒ boolean
remove an indicator - default or registered user defined
Kind: global function
Returns: boolean
- - success / failure
Param | Type | Description |
---|---|---|
i | string | Indicator | indicator id or Indicator instance |
indicatorSettings(i, s) ⇒ Object
set or get indicator settings
Kind: global function
Returns: Object
- - settings
Param | Type | Description |
---|---|---|
i | string | Indicator | indicator id or Indicator instance |
s | Object | settings |
hasStateIndicator(i, dataset) ⇒ Indicator
| false
Does current chart state have indicator
Kind: global function
Param | Type | Default | Description |
---|---|---|---|
i | string | indicator id or name | |
dataset | string | “searchAll” |
calcAllIndicators()
calculate all indicators currently in use
Kind: global function