microsoft / charticulator

Interactive Layout-Aware Construction of Bespoke Charts
Other
833 stars 115 forks source link

Waterfall Links #851

Open PBI-David opened 2 years ago

PBI-David commented 2 years ago

I'm trying to create a waterfall chart without success. I think this may have already been raised in #156 and #185 but not fully resolved. Essentially, the MSFT demo waterfall only works when the total does not net to zero. A quote from the issues above states:

Here is the problem: when the "stacking" scaffold is used, it's going to put the beginning of the first bar to the bottom, and the ending of the last bar to the top. However, your data sums to zero, this means the beginning of the first bar and the ending of the last bar should be the same. This creates a conflict. This is an issue by design so we can't easily fix it.

Well my data for the waterfall does sum to zero so I tried the workaround of using a data axis which works fine as below.

image

However, there is no way to create links between the bars as per a normal waterfall and the original MSFT demo. When I try using links, the links created are all over the place with very little control on them. The desired output is mocked up below.

image

Attached is a sample .pbix. Watrerfall.zip

Is it possible to create a waterfall (that sums to zero) with current functionality?

vulkany commented 2 years ago

Hi, I'm trying to create a waterfall using your .pbix, but I can't do it. Can you give me the steps I should take to get the same result you got?

Thanks

PBI-David commented 2 years ago

@vulkany here it is attached properly this time. You should be able to recreate from this although I'm not even sure this is the right approach to be honest. It would be good to get some feedback form the experts. Waterfall.zip

If your waterfall does not net to zero, here is the proper way of creating one. https://charticulator.com/gallery/stock_msft.html

legszesz commented 2 years ago

Hi,

You need 4 links to cover all possible lines connecting the Glyphs, and a measure to choose the line to be colored. 1: from top to top 2: from top to bottom 3: from bottom to top 4: from bottom to bottom

For the measure a logic has to be applied, so I just hardcoded a new column into your source data called Link. This column is used to color all 4 links. When pulling this column onto the color attribute, shift has to be held down. "Auto update values" is not ticked in the color settings.

Waterfall.zip

PBI-David commented 2 years ago

Outstanding @legszesz. Thank you very much.