type SeriesStyle = {
color: [Color, null],
label: [string, null],
stroke_width: [f64, null],
point_size: [f64, null]
};
type BarStyle = {
color: [Color, null],
label: [string, null],
margin: [f64, null]
};
type CandlestickStyle = {
gain_color: [Color, null],
loss_color: [Color, null],
bar_width: [f64, null],
label: [string, null]
};
type PieStyle = {
colors: [Array<Color>, null],
donut: [f64, null],
label_offset: [f64, null],
show_percentages: [bool, null],
start_angle: [f64, null]
};
type SurfaceStyle = {
color: [Color, null],
color_by_z: [bool, null],
label: [string, null]
};
type Projection3D = {
pitch: [f64, null],
scale: [f64, null],
yaw: [f64, null]
};
type MeshStyle = {
show_x_grid: [bool, null],
show_y_grid: [bool, null],
grid_color: [Color, null],
axis_color: [Color, null],
label_color: [Color, null],
label_size: [f64, null],
x_label_area_size: [f64, null],
x_labels: [i64, null],
y_label_area_size: [f64, null],
y_labels: [i64, null]
};
type LegendStyle = {
background: [Color, null],
border: [Color, null],
label_color: [Color, null],
label_size: [f64, null]
};
type LegendPosition = [
`UpperLeft, `UpperRight, `LowerLeft, `LowerRight,
`MiddleLeft, `MiddleRight, `UpperMiddle, `LowerMiddle
];
type OhlcPoint<'a: [f64, datetime]> = {x: 'a, open: f64, high: f64, low: f64, close: f64};
type ErrorBarPoint<'a: [f64, datetime]> = {x: 'a, min: f64, avg: f64, max: f64};
type Dataset = [
`Line({data: &[Array<(f64, f64)>, Array<(datetime, f64)>], style: SeriesStyle}),
`Scatter({data: &[Array<(f64, f64)>, Array<(datetime, f64)>], style: SeriesStyle}),
`Bar({data: &Array<(string, f64)>, style: BarStyle}),
`Area({data: &[Array<(f64, f64)>, Array<(datetime, f64)>], style: SeriesStyle}),
`DashedLine({data: &[Array<(f64, f64)>, Array<(datetime, f64)>], dash: f64, gap: f64, style: SeriesStyle}),
`Candlestick({data: &[Array<OhlcPoint<f64>>, Array<OhlcPoint<datetime>>], style: CandlestickStyle}),
`ErrorBar({data: &[Array<ErrorBarPoint<f64>>, Array<ErrorBarPoint<datetime>>], style: SeriesStyle}),
`Pie({data: &Array<(string, f64)>, style: PieStyle}),
`Scatter3D({data: &Array<(f64, f64, f64)>, style: SeriesStyle}),
`Line3D({data: &Array<(f64, f64, f64)>, style: SeriesStyle}),
`Surface({data: &Array<Array<(f64, f64, f64)>>, style: SurfaceStyle})
];
type Chart = {
datasets: &Array<Dataset>,
title: &[string, null],
title_color: &[Color, null],
x_label: &[string, null],
y_label: &[string, null],
x_range: &[{min: f64, max: f64}, {min: datetime, max: datetime}, null],
y_range: &[{min: f64, max: f64}, null],
z_label: &[string, null],
z_range: &[{min: f64, max: f64}, null],
projection: &[Projection3D, null],
width: &Length,
height: &Length,
background: &[Color, null],
margin: &[f64, null],
title_size: &[f64, null],
legend_position: &[LegendPosition, null],
legend_style: &[LegendStyle, null],
mesh: &[MeshStyle, null]
};
val chart: fn(
?#title: &[string, null],
?#title_color: &[Color, null],
?#x_label: &[string, null],
?#y_label: &[string, null],
?#x_range: &[{min: f64, max: f64}, {min: datetime, max: datetime}, null],
?#y_range: &[{min: f64, max: f64}, null],
?#z_label: &[string, null],
?#z_range: &[{min: f64, max: f64}, null],
?#projection: &[Projection3D, null],
?#width: &Length,
?#height: &Length,
?#background: &[Color, null],
?#margin: &[f64, null],
?#title_size: &[f64, null],
?#legend_position: &[LegendPosition, null],
?#legend_style: &[LegendStyle, null],
?#mesh: &[MeshStyle, null],
datasets: &Array<Dataset>
) -> Widget;
val line: fn(
?#color: [Color, null],
?#label: [string, null],
?#stroke_width: [f64, null],
?#point_size: [f64, null],
data: &[Array<(f64, f64)>, Array<(datetime, f64)>]
) -> Dataset;
val scatter: fn(
?#color: [Color, null],
?#label: [string, null],
?#stroke_width: [f64, null],
?#point_size: [f64, null],
data: &[Array<(f64, f64)>, Array<(datetime, f64)>]
) -> Dataset;
val bar: fn(
?#color: [Color, null],
?#label: [string, null],
?#margin: [f64, null],
data: &Array<(string, f64)>
) -> Dataset;
val area: fn(
?#color: [Color, null],
?#label: [string, null],
?#stroke_width: [f64, null],
?#point_size: [f64, null],
data: &[Array<(f64, f64)>, Array<(datetime, f64)>]
) -> Dataset;
val dashed_line: fn(
?#color: [Color, null],
?#label: [string, null],
?#stroke_width: [f64, null],
?#point_size: [f64, null],
?#dash: f64,
?#gap: f64,
data: &[Array<(f64, f64)>, Array<(datetime, f64)>]
) -> Dataset;
val candlestick: fn(
?#gain_color: [Color, null],
?#loss_color: [Color, null],
?#bar_width: [f64, null],
?#label: [string, null],
data: &[Array<OhlcPoint<f64>>, Array<OhlcPoint<datetime>>]
) -> Dataset;
val error_bar: fn(
?#color: [Color, null],
?#label: [string, null],
?#stroke_width: [f64, null],
?#point_size: [f64, null],
data: &[Array<ErrorBarPoint<f64>>, Array<ErrorBarPoint<datetime>>]
) -> Dataset;
val mesh_style: fn(
?#show_x_grid: [bool, null],
?#show_y_grid: [bool, null],
?#grid_color: [Color, null],
?#axis_color: [Color, null],
?#label_color: [Color, null],
?#label_size: [f64, null],
?#x_label_area_size: [f64, null],
?#x_labels: [i64, null],
?#y_label_area_size: [f64, null],
?#y_labels: [i64, null]
) -> MeshStyle;
val pie: fn(
?#colors: [Array<Color>, null],
?#donut: [f64, null],
?#start_angle: [f64, null],
?#show_percentages: [bool, null],
?#label_offset: [f64, null],
data: &Array<(string, f64)>
) -> Dataset;
val scatter3d: fn(
?#color: [Color, null],
?#label: [string, null],
?#stroke_width: [f64, null],
?#point_size: [f64, null],
data: &Array<(f64, f64, f64)>
) -> Dataset;
val line3d: fn(
?#color: [Color, null],
?#label: [string, null],
?#stroke_width: [f64, null],
?#point_size: [f64, null],
data: &Array<(f64, f64, f64)>
) -> Dataset;
val surface: fn(
?#color: [Color, null],
?#label: [string, null],
?#color_by_z: [bool, null],
data: &Array<Array<(f64, f64, f64)>>
) -> Dataset;
val legend_style: fn(
?#background: [Color, null],
?#border: [Color, null],
?#label_color: [Color, null],
?#label_size: [f64, null]
) -> LegendStyle