Basic Waterfall Chart#

Generate a waterfall chart using the waterfall_chart function. Waterfall charts can show the net result of a starting value after a series of positive/negative adjustments.

  • series must be used to specify data points that are the starting ending totals, incremental additions, and incremental subtractions

  • The y1_axis can be used to customize y-axis behavior

  • data must be a single row with each column representing a total, addition, or subtraction

  • total must be two series each representing the starting value and ending value respectively



import pandas as pd

from visualization_toolkit.helpers.plotly import waterfall_chart, axis, series


fig = waterfall_chart(
    pdf,
    y1_axis=axis(label="Spend", axis_type="currency"),
    totals=[
        series(
            column_name="prior_period",
            label="Prior Period",
        ),
        series(
            column_name="ending_period",
            label="Ending Period",
        ),
    ],
    additions=[
        series(
            column_name="expansion",
            label="Expansion",
        ),
    ],
    subtractions=[
        series(
            column_name="contraction",
            label="Contraction",
        ),
        series(
            column_name="churn",
            label="Churn",
        ),
    ],
)

fig

Total running time of the script: (0 minutes 0.016 seconds)

Gallery generated by Sphinx-Gallery