plotly / plotly.js

Open-source JavaScript charting library behind Plotly and Dash
https://plotly.com/javascript/
MIT License
16.83k stars 1.85k forks source link

add stacked waterfall charts #4450

Open nicolaskruchten opened 4 years ago

nicolaskruchten commented 4 years ago

broken off from #2221 ...

Let’s gather up some requirements for stacked waterfalls here, ideally including screenshots of the desired output.

nicolaskruchten commented 4 years ago

I see at least two variants:

  1. Multiple distinct waterfall traces that must have the same x and measure and sign for all y (could be implemented with a waterfallmode of stack)
  2. The ability for a single trace to have multiple y values (of the same sign) for a given x (could be implemented with no new attributes in principle?)
nicolaskruchten commented 4 years ago

In principle we could apply the same stacking/overlapping rules we have for bar in both cases... ugly but well-defined.

And for case 1, we would just always use the measure from the first trace in a given subplot, to avoid conflicts.

jdb78 commented 4 years ago

I like the multiple traces with waterfallmode="stack" as it is consistent with other other trace types.

  1. if the y values are of different sign, we could show something like this: image

  2. We only stack for overlapping x (consistent with bar) and measure

  3. We allow null values for y which prevents the any hover animations

What are your thoughts?

nicolaskruchten commented 4 years ago

Your case 1 above would actually be closer to waterfallmode="relative" to match the current barmode="relative" case... it's kind of ugly but it has a certain logic to it I'll admit :)

whippysundew commented 2 years ago

Hi Everyone,

I am very interested in the possibility of a Plotly Stacked Waterfall. The image posted by jdb78 is exactly what I am looking for. I think this solution would fill a large gap in Python’s data visualization capabilities and attract more developers to Plotly.

Can you please advise me on how I can make this dream become a reality? :)

Thank you

alexcjohnson commented 2 years ago

@whippysundew I think we still need a little more information about the kind of data it would be useful to represent with such a stack, and come to a consensus on the API for this that's most consistent with our other traces such as bar. After that we can look back at previous waterfall PRs such as https://github.com/plotly/plotly.js/pull/3531 to see where the code needs to be amended.

whippysundew commented 2 years ago

@alexcjohnson thank you for your insight. Let’s use software sales data as an example with waterfall columns as follows: YTD revenue (+), won business yet to hit revenue (+), net pipeline (pipeline + business at risk, + or -), total projected performance (+). The stack would be helpful to display different regions or lines of business while still representing the total performance. It would be very beneficial to allow positive or negative values in each column - say one region has a positive net pipeline while another is negative. The chart above shows how this can be displayed.

etiennecelery commented 1 year ago

Definitely a useful feature to add, I was trying to showcase the capital returns of multiple companies, so you have initial assets in t0 and final assets in t1, just like the Plotly waterfall example. It would be great if those initial and final bars could be dissagregated into multiple stacked bars. Just a thought.

NolsN74 commented 9 months ago

any news on this issue?

yogeshriyat commented 5 months ago

Hi any update on this stacked waterfall chart?