SED navigation bar go to SED home page go to Dataplot home page go to NIST home page SED Home Page SED Staff SED Projects SED Products and Publications Search SED Pages
Dataplot Vol 2 Vol 1

WATERFALL CHART

Name:
    WATERFALL CHART
Type:
    Graphics Command
Purpose:
    Generates a waterfall chart.
Description:
    A waterfall chart is a variant of the bar chart that shows how an initial value changes over a series of positive and negative values. Specifically, it draws a bar from the "before" value to the "after" value.

    Given a response variable Y, the first bar is drawn from zero to Y(1), the second bar is drawn from Y(1) to (Y(1) + Y(2)), and so on. You can optionally request that the final value be plotted from zero the final value with the command (this is the default)

      SET WATERFALL CHART FINAL VALUE ON

    To turn this off, use the command

      SET WATERFALL CHART FINAL VALUE OFF

    It is sometimes desired to plot all the positive values and then all the negative values. In this case, you can optionally request that after the positive values a bar be drawn from the sum of the positive values to zero. To request this, enter

      SET WATERFALL CHART TOTAL POSITIVE ON

    To turn this off, use the command

      SET WATERFALL CHART TOTAL POSITIVE OFF

    The default is ON. Note that if the response variable is not sorted so that all the positive values come before the negative values, then this option will not be implemented.

    By default, the x-axis value is simply the sequence number. However, you can optionally specify an x-axis variable. For example, you may want to leave a space to add your own bars for intermediate sub-totals.

    The width of the bars can be specified with the command

      SET WATERFALL CHART BAR WIDTH <value>

    The default is 1 with <value> typically in the range 0.5 to 1.

    The appearance of the plot can be controlled with REGION commands. Specifically,

    1. The settings for trace 1 specify the attributes of the positive value bars.

    2. The settings for trace 2 specify the attributes of the negative value bars.

    3. The settings for trace 3 specify the attributes of the "total positive" and "final value" bars.

    This is demonstrated in the Program examples below.

Syntax 1:
    WATERFALL CHART <y1>             <SUBSET/EXCEPT/FOR qualification>
    where <y> is the response variable;
    and where the <SUBSET/EXCEPT/FOR qualification> is optional.

    For this syntax, the x-axis value is simply the sequence number.

Syntax 2:
    WATERFALL CHART <y> <x>             <SUBSET/EXCEPT/FOR qualification>
    where <y> is the response variable;
                <x> is the horizontal axis variable;
    and where the <SUBSET/EXCEPT/FOR qualification> is optional.
Examples:
    WATERFALL CHART Y
    WATERFALL CHART Y X
Note:
    The literature distinguishes between a waterfall plot and a waterfall chart. For that reason, we do not support WATERFALL PLOT as a synonym for WATERFALL CHART.
Default:
    SET WATERFALL CHART TOTAL POSITIVE ON
    SET WATERFALL CHART FINAL VALUE ON
    SET WATERFALL CHART BAR WIDTH 1
Synonyms:
    None
Related Commands:
    CHARACTERS = Sets the type for plot characters.
    LINES = Sets the type for plot lines.
    REGION FILL = Sets the type for plot regions.
    PLOT = Generates a data or function plot.
Reference:
    Ethan M. Rasiel, "The McKinsey Way," McGraw–Hill, 1999.
Applications:
    Presentation Graphics
Implementation Date:
    2025/06
Program 1:
     
    . Step 1:   Create the data - this example from Wikipedia
    .
    read y
     420
     210
    -170
    -140
    end of data
    .
    . Step 2:   Set plot control
    .
    case asis
    title case asis
    label case asis
    tic mark label case asis
    .
    let n    = size y
    let ntot = n + 2
    xlimits 1 ntot
    major x1tic mark number ntot
    minor x1tic mark number 0
    x1tic mark label format alpha
    x1tic mark label content Productcr()Revenue Servicescr()Revenue Totalcr()Revenue ...
          Fixedcr()Costs Variablecr()Costs Total
    tic mark offset units data
    x1tic mark offset 0.8 0.8
    .
    set waterfall chart total positive on
    set waterfall chart final value    on
    set waterfall chart bar width     0.8
    .
    region fill on on on
    region fill color green red blue
    line blank all
    .
    . Step 3:   Generate the plot
    .
    y1label Dollars
    title Waterfall Chart (Wikipedia Example)
    waterfall chart y
        
Program 2:
     
    . Step 1:   Create the data - this example from Wikipedia
    .
    read y
     217
     -55
      37
    end of data
    .
    . Step 2:   Set plot control
    .
    case asis
    title case asis
    label case asis
    tic mark label case asis
    .
    let n    = size y
    let ntot = n + 1
    xlimits 1 ntot
    major x1tic mark number ntot
    minor x1tic mark number 0
    x1tic mark label format alpha
    x1tic mark label content Unitssp()incr()Stock Damaged Refurbished Salablecr()Units
    tic mark offset units data
    x1tic mark offset 0.8 0.8
    .
    set waterfall chart final value    on
    set waterfall chart bar width     0.5
    .
    region fill on on on
    region fill color green red cyan
    .
    . Step 3:   Generate the plot
    .
    y1label Number of Units
    title Waterfall Chart for Inventory Audit of Men's Tee-Shirts (Wikipedia Example)
    waterfall chart y
    .
    justification center
    let ycum = cumulative sum y
    let nlast = ntot - 1
    loop for k = 1 1 nlast
        let xcoor = k
        let aval = y(k)
        if aval >= 0
           let ycoor = ycum(k)
           let ycoor = ycoor + 10
        else
           let km1 = k - 1
           let ycoor = ycum(km1)
           let ycoor = ycoor + 10
        end of if
        move data xcoor ycoor
        text ^aval
    end of loop
    let aval = ycum(nlast)
    let ycoor = aval + 10
    move data ntot ycoor
    text ^aval
        
Date created: 05/22/2025
Last updated: 05/22/2025

Please email comments on this WWW page to [email protected].