Type/to search
Built-in Functions
Structures
Ticker
Depth
OrderBook
Trade
Record
Market
Order
Condition
Account
Asset
Position
Funding
Other Structures
HttpQuery-options
HttpQuery-return
LogStatus-table
LogStatus-btnTypeOne
LogStatus-btnTypeTwo
Status Bar Components
grid
tabs
kpi
stat
progress
gauge
sparkline
chart
heatmap
calendar
histogram
pie
timeline
markdown
alert
badge
Chart-options
Chart-return
KLineChart-options
KLineChart-return
SetData-data
EventLoop-return
exchange.Go-return
DBExec-return
Dial-return
Thread.join-return
Built-in Variables and Constants
Conventions
Exchanges

Draws line, bar or area charts with several series, a right axis and buy/sell marks; use Chart for more options.

Examples

Close prices as a line with volume bars on the right axis, and a mark at the highest close.

javascript
function main() { var r = exchange.GetRecords(PERIOD_H1) if (!r || r.length < 48) return r = r.slice(-48) var top = r.reduce(function (a, b) { return b.Close > a.Close ? b : a }) LogStatus({ type: "chart", title: "Last 48 hours", x: r.map(function (b) { return b.Time }), series: [ {name: "Close", data: r.map(function (b) { return b.Close })}, {name: "Volume", kind: "bar", axis: "right", color: "muted", data: r.map(function (b) { return b.Volume })} ], marks: [{x: top.Time, text: "High", color: "up"}] }) }
python
def main(): r = exchange.GetRecords(PERIOD_H1) if not r or len(r) < 48: return r = r[-48:] top = max(r, key=lambda b: b["Close"]) LogStatus({ "type": "chart", "title": "Last 48 hours", "x": [b["Time"] for b in r], "series": [ {"name": "Close", "data": [b["Close"] for b in r]}, {"name": "Volume", "kind": "bar", "axis": "right", "color": "muted", "data": [b["Volume"] for b in r]} ], "marks": [{"x": top["Time"], "text": "High", "color": "up"}] })
rust
fn join<T: ToString>(v: impl Iterator<Item = T>) -> String { v.map(|x| x.to_string()).collect::<Vec<_>>().join(",") } fn main() { let Ok(r) = exchange.GetRecords(None, PERIOD_H1, None) else { return }; if r.len() < 48 { return; } let r = &r[r.len() - 48..]; let top = r.iter().fold(&r[0], |a, b| if b.Close > a.Close { b } else { a }); LogStatus!(format!( r#"{{"type": "chart", "title": "Last 48 hours", "x": [{}], "series": [ {{"name": "Close", "data": [{}]}}, {{"name": "Volume", "kind": "bar", "axis": "right", "color": "muted", "data": [{}]}}], "marks": [{{"x": {}, "text": "High", "color": "up"}}]}}"#, join(r.iter().map(|b| b.Time)), join(r.iter().map(|b| b.Close)), join(r.iter().map(|b| b.Volume)), top.Time )); }

Attributes

NameTypeDescription

type

string

Required. Always chart.

series

object array

Required. Data series.

series[].data

numeric array

Required. One value per x; non-numeric items leave a gap.

series[].name

string

Legend name.

series[].kind

string

Type of this series, overriding kind.

series[].color

string

Series color, assigned in order by default. Values: see Status Bar Components.

series[].axis

string

right draws the series on the right axis, for data of a different scale (such as price and volume).

kind

string

line, bar or area. Default line.

x

string array / numeric array

X-axis values. A time axis when all are millisecond timestamps; indexes when omitted.

marks

object array

Marks such as buy/sell or rebalance points.

marks[].x

string / number

Required. A value of x; on a time axis the nearest point.

marks[].y

number

Y value. Defaults to the first series at that point.

marks[].text

string

Mark label.

marks[].color

string

up draws ▲ below the line, down draws ▼ above it, other colors draw a dot.

stacked

bool

Stack the series. Default false.

height

number

Height in pixels, 120–600. Default 260.

format

object

Left-axis number format, default {"compact": true}; see Status Bar Components.

rightFormat

object

Right-axis number format. Defaults to format.

title

string

Title shown at the top left of the component.

id

string

Stable identifier. Set it when the number or order of components changes, so refreshes do not rebuild the component.

span

number

Number of columns it spans in the enclosing grid. Default 1.

See Also

Remarks

Each series holds at most 5000 points; more shows an error card. A legend is shown for several series; drag on the chart to zoom into an x range.