fix(funnel/waterfall): respect textinfo token order#7752
fix(funnel/waterfall): respect textinfo token order#7752Abineshabee wants to merge 4 commits intoplotly:masterfrom
Conversation
|
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? |
emilykl
left a comment
There was a problem hiding this comment.
Left a few comments, I'll take another look once you're ready @Abineshabee !
|
@emilykl I've addressed both points:
|
|
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. |
|
@emilykl Updated the test with proper safety checks. Ready for another look! |
|
@emilykl The only remaining CI failure is All funnel and waterfall tests pass. Ready for review! |
What this fixes
Fixes #7751
go.Funnelwithtextinfo="percent initial+value"was displayingvalue before percent (e.g. "700 70.0%") regardless of the order
specified by the user.
Root cause
In
src/traces/bar/plot.js, thecalcTextinfofunction pushedfunnel tokens (
value,percent initial/previous/total) andwaterfall tokens (
initial,delta,final) in a hardcodedsequence, ignoring the order of tokens in the
textinfostring.Fix
Replaced hardcoded
hasFlag()checks with a loop overparts[](the user-specified token order) for both funnel and waterfall traces.
Before
"percent initial+value" → "1000 100.0%" ❌

After
"percent initial+value" → "100.0% 1000" ✅

Notes
order was already correct
labelandtexttokens still use fixed ordering and arenot modified in this PR