Skip to content

fix(funnel/waterfall): respect textinfo token order#7752

Open
Abineshabee wants to merge 4 commits intoplotly:masterfrom
Abineshabee:fix/textinfo-token-order
Open

fix(funnel/waterfall): respect textinfo token order#7752
Abineshabee wants to merge 4 commits intoplotly:masterfrom
Abineshabee:fix/textinfo-token-order

Conversation

@Abineshabee
Copy link
Copy Markdown

@Abineshabee Abineshabee commented Apr 13, 2026

What this fixes

Fixes #7751

go.Funnel with textinfo="percent initial+value" was displaying
value before percent (e.g. "700 70.0%") regardless of the order
specified by the user.

Root cause

In src/traces/bar/plot.js, the calcTextinfo function pushed
funnel tokens (value, percent initial/previous/total) and
waterfall tokens (initial, delta, final) in a hardcoded
sequence, ignoring the order of tokens in the textinfo string.

Fix

Replaced hardcoded hasFlag() checks with a loop over parts[]
(the user-specified token order) for both funnel and waterfall traces.

Before

"percent initial+value" → "1000 100.0%" ❌
Screenshot 2026-04-13 230956

After

"percent initial+value" → "100.0% 1000" ✅
Screenshot 2026-04-13 232120

Notes

  • Backward compatible — existing behavior unchanged when token
    order was already correct
  • label and text tokens still use fixed ordering and are
    not modified in this PR
  • Fix applies to both funnel and waterfall traces as requested

@emilykl
Copy link
Copy Markdown
Contributor

emilykl commented Apr 13, 2026

Hi @Abineshabee ! Thanks for the PR. This looks like it's on the right track; I'll take a review pass through the code. Let us know if you would like assistance with the failing test.

Could you please update the PR description to include screenshots or a codepen demonstrating the fix?

Copy link
Copy Markdown
Contributor

@emilykl emilykl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few comments, I'll take another look once you're ready @Abineshabee !

@Abineshabee
Copy link
Copy Markdown
Author

@emilykl I've addressed both points:

  1. Switched to for (var part in parts) loop syntax
  2. Included label and text flags inside the ordered loop
    so all tokens now respect user-specified order consistently.
    Also normalized parts with .map(p => p.trim()) to handle
    any whitespace edge cases. Ready for another look!

@emilykl
Copy link
Copy Markdown
Contributor

emilykl commented Apr 13, 2026

Thanks @Abineshabee for the quick turnaround! Before I take another look, can you update the PR description to add screenshots of the fix in action, and also fix the failing test? I'm happy to assist with either, just let me know.

@Abineshabee
Copy link
Copy Markdown
Author

@emilykl Updated the test with proper safety checks. Ready for another look!

@Abineshabee
Copy link
Copy Markdown
Author

@emilykl The only remaining CI failure is isosurface_test.js @gl should display hover labels
which is a pre-existing flaky GL test unrelated to this PR.
It fails inconsistently across runs (different hover values each time)
and is not caused by my changes to src/traces/bar/plot.js.

All funnel and waterfall tests pass. Ready for review!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: go.Funnel textinfo="percent initial+value" shows value before percent.

2 participants