Skip to content

Waterfall Chart consumes the last data row as its total bar, so that row's value is never plotted #7974

Description

@kz930

What happened?

The Waterfall Chart operator marks the last row of the input as the chart's total bar
(measure=["relative"] * (len(y_values) - 1) + ["total"]). Plotly draws a total bar at
the accumulated sum of the preceding bars and ignores the value supplied for it, so the
last row's value is silently excluded from the chart while its data label still shows
that value.

Minimal case, four rows with values 1, 2, 3, 4. The final bar is drawn at 6, which is
1+2+3, and is labelled +4. The correct total for the four rows is 10, and the value 4
appears in no bar.

On a fifteen-row table whose values sum to 45.7 with a last row of 3.3, the final bar is
drawn at 42.4 and labelled +3.3:

Waterfall chart whose final bar is drawn at 42.4 but labelled +3.3

Nothing in the operator asks for a summary row. The two fields are described as
"categories or stages" and "numeric values for each stage", and there is no option
controlling whether a total is drawn, so a plain detail table produces a bar whose height
and label disagree.

A second consequence appears when the X column is numeric and not already sorted. Plotly
orders a numeric axis by value while measure is positional, so the total bar is drawn
wherever that row's X value falls, which can be the middle of the chart with ordinary
increasing bars to the right of it.

The same code is generated by both generatePythonCode and generateStandaloneCode, so
the two agree with each other and the parity tests pass.

How to reproduce?

  1. Build a workflow of CSV File Scan into Waterfall Chart.
  2. Use a four-row table with a numeric column holding 1, 2, 3, 4 and any column for the
    X axis.
  3. Set X Axis Values to the label column and Y Axis Values to the numeric column, then
    run.
  4. The last bar is drawn at 6 and labelled +4.

Version/Branch

1.3.0-incubating-SNAPSHOT (main)

Commit Hash (Optional)

2c2c0e5

What browsers are you seeing the problem on?

Chrome

Relevant log output

_No response_

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions