Candlestick
candlestick() over named columns of a dataframe_mojo DataFrame (#743). Each argument names a column instead of holding the values.
Usage
from dataviz import candlestick
from dataviz import save
from dataviz import Theme
def main() raises:
# Illustrative daily OHLC prices across twelve trading sessions.
var days: List[String] = [
"Sep 1", "Sep 2", "Sep 3", "Sep 4", "Sep 5", "Sep 8",
"Sep 9", "Sep 10", "Sep 11", "Sep 12", "Sep 15", "Sep 16",
]
var open: List[Int] = [100, 104, 101, 97, 107, 110, 103, 108, 105, 111, 116, 113]
var high: List[Int] = [106, 105, 103, 108, 112, 111, 109, 110, 113, 118, 119, 117]
var low: List[Int] = [98, 99, 95, 96, 105, 102, 101, 104, 103, 109, 112, 108]
var close: List[Int] = [104, 101, 97, 107, 110, 103, 108, 105, 111, 116, 113, 110]
var c = candlestick(
days,
open,
high,
low,
close,
title="Illustrative Daily OHLC Prices",
x_title="Trading session",
y_title="Share price ($)",
)
save(c, "docs/src/examples/out_candlestick.svg")See Data shapes for shared input conventions.
Args:
df: The frame to read.categories: A string category or date/datetime time column.open: The numeric column for this channel.high: The numeric column for this channel.low: The numeric column for this channel.close: The numeric column for this channel.theme: See the list overload.width: See the list overload.height: See the list overload.title: See the list overload.subtitle: See the list overload.x_title: See the list overload.y_title: See the list overload.
Related
Related charts: Stacked Area
Relevant API: candlestick