Waterfall
waterfall() over named columns of a dataframe_mojo DataFrame (#743). Each argument names a column instead of holding the values.
Usage
from dataviz import waterfall
from dataviz import save
from dataviz import Theme
def main() raises:
var stages: List[String] = ["Starting", "Revenue", "COGS", "Opex", "Tax", "One-off", "Ending"]
var deltas: List[Int] = [50, 32, -18, -12, -6, 4, 0]
var is_total: List[Bool] = [True, False, False, False, False, False, True]
var c = waterfall(
stages,
deltas,
is_total=is_total,
title="Operating Profit Bridge",
x_title="Stage",
y_title="Operating profit ($k)",
)
save(c, "docs/src/examples/out_waterfall.svg")See Data shapes for shared input conventions.
Args:
df: The frame to read.categories: The string column for this channel.deltas: The numeric column for this channel.is_total: The boolean column for this channel; left empty, the channel is unused.delta_width_fraction: See the list overload.horizontal: See the list overload.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 Bar · Bullet
Relevant API: waterfall