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

Shows the share of each part in the total; a donut by default with the total in the center.

Examples

Shows how margin is split across positions.

javascript
function main() { exchange.SetContractType("swap") var positions = exchange.GetPositions() if (!positions) return var items = positions.map(function (p) { return {name: p.Symbol, value: p.Margin} }) LogStatus({type: "pie", title: "Margin by position", legend: true, items: items, format: {precision: 2}}) }
python
def main(): exchange.SetContractType("swap") positions = exchange.GetPositions() if positions is None: return items = [{"name": p["Symbol"], "value": p["Margin"]} for p in positions] LogStatus({"type": "pie", "title": "Margin by position", "legend": True, "items": items, "format": {"precision": 2}})
rust
fn main() { if exchange.SetContractType("swap").is_err() { return; } let Ok(positions) = exchange.GetPositions(None) else { return }; let items: Vec<String> = positions.iter() .map(|p| format!(r#"{{"name": "{}", "value": {}}}"#, p.Symbol, p.Margin)) .collect(); LogStatus!(format!( r#"{{"type": "pie", "title": "Margin by position", "legend": true, "items": [{}], "format": {{"precision": 2}}}}"#, items.join(",") )); }

Attributes

NameTypeDescription

type

string

Required. Always pie.

items

object array

Required. The parts; entries without name or value, or with a negative value, are skipped.

items[].name

string

Required. Name.

items[].value

number

Required. Value, not negative.

items[].color

string

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

donut

bool

Donut chart; false draws a solid pie. Default true.

legend

bool

List the parts next to the chart. Default false: values show on hover (tap on phones).

format

object

Number format {precision, compact, percent}; see Status Bar Components.

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