Difference between revisions of "Waterfall Charts"
(Created page with 'image:Waterfall chart example.png A waterfall chart is a type of bar chart, similar to a stacked bar chart except that bars don't overlap and the origin of each bar starts w…') |
|||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
− | [[ | + | [[Category: Graphs]] |
− | A waterfall chart is a type of bar chart, similar to a stacked bar chart except that bars don't overlap and the origin of each bar starts where the previous bar ended, allowing negative values to be readily depicted. It is often used because most graphing packages don't handle negative value intelligently when plotting stacked bar charts. Analytica's standard stacked bar chart does handle negative values intelligently, so it does provide a good alternative to the waterfall chart. This page provides instructions for plotting a standard waterfall-variety of bar chart, as depicted in the diagram above. | + | __TOC__ |
+ | |||
+ | |||
+ | :[[image:Waterfall chart example.png]] | ||
+ | |||
+ | A waterfall chart is a type of bar chart, similar to a [[Stacked clustered bar charts|stacked bar chart]] except that bars don't overlap and the origin of each bar starts where the previous bar ended, allowing negative values to be readily depicted. It is often used because most graphing packages don't handle negative value intelligently when plotting stacked bar charts. Analytica's standard stacked bar chart does handle negative values intelligently, so it does provide a good alternative to the waterfall chart. This page provides instructions for plotting a standard waterfall-variety of bar chart, as depicted in the diagram above. | ||
The example used in the above chart can be downloaded here: [[media:Waterfall chart example.ana|Waterfall chart example.ana]] | The example used in the above chart can be downloaded here: [[media:Waterfall chart example.ana|Waterfall chart example.ana]] | ||
The waterfall chart is in the "P&L" result graph. | The waterfall chart is in the "P&L" result graph. | ||
+ | |||
+ | == How its done == | ||
+ | |||
+ | To create the chart, you will plot a bar chart with 0% bar overlap. The end of each bar is the [[Cumulate|cumulative value]] of the result across the key index, the same way it would be in a stacked bar chart. The origin of each bar is the previous cumulative value along the key index -- i.e., where the previous bar left off. | ||
+ | |||
+ | In the example, we wish to create a waterfall of <code>P_L_items</code> ("P&L items"), which is a [[Self-Indexed Arrays|self-indexed array]], with the self-index <code>P_L_items</code> serving as the graph key. | ||
+ | |||
+ | To be more general, in what follows, we'll refer to the value to be plotted as <code>X</code> and the key-index as <code>K</code>. Our waterfall graph will appear in a new variable, <code>Waterfall_X</code>, defined as: | ||
+ | |||
+ | :<code>Cumulate(X, K)</code> | ||
+ | |||
+ | Next, we need to compute the origin for each bar. We'll compute this in a variable named <code>Waterfall_prev</code> defined as: | ||
+ | |||
+ | :<code>if @K = 1 then 0 else Waterfall_X[@K = @K - 1]</code> | ||
+ | |||
+ | This states that each bar will start where the previous bar left off, with the first bar in each series starting at 0. | ||
+ | |||
+ | Show the result graph for <code>Waterfall_X</code> and press the '''XY''' button on the top-right corner. Check '''Use another variable''' and add <code>Waterfall_prev</code>, then press '''OK''' to close the [[XY comparison]] sources dialog. | ||
+ | |||
+ | Pivot the graph so that <code>K</code> is the graph key, and your time dimension is on the horizontal axis. | ||
+ | |||
+ | Select ''''Result → Graph Setup...'''. Set the '''Line Style''' to solid bar, place a check box on '''Variable origin''', uncheck ''''Swap horizontal and vertical''', and enter ''Bar overlap = 0%''. Press '''Apply'''. | ||
+ | |||
+ | ==See Also== | ||
+ | * [[media:Waterfall chart example.ana|Waterfall chart example.ana]] | ||
+ | * [[Stacked clustered bar charts]] | ||
+ | * [[Heat maps]] | ||
+ | * [[XY comparison]] | ||
+ | * [[Graph settings]] | ||
+ | * [[Graph setup dialog]] |
Latest revision as of 00:18, 17 February 2016
A waterfall chart is a type of bar chart, similar to a stacked bar chart except that bars don't overlap and the origin of each bar starts where the previous bar ended, allowing negative values to be readily depicted. It is often used because most graphing packages don't handle negative value intelligently when plotting stacked bar charts. Analytica's standard stacked bar chart does handle negative values intelligently, so it does provide a good alternative to the waterfall chart. This page provides instructions for plotting a standard waterfall-variety of bar chart, as depicted in the diagram above.
The example used in the above chart can be downloaded here: Waterfall chart example.ana
The waterfall chart is in the "P&L" result graph.
How its done
To create the chart, you will plot a bar chart with 0% bar overlap. The end of each bar is the cumulative value of the result across the key index, the same way it would be in a stacked bar chart. The origin of each bar is the previous cumulative value along the key index -- i.e., where the previous bar left off.
In the example, we wish to create a waterfall of P_L_items
("P&L items"), which is a self-indexed array, with the self-index P_L_items
serving as the graph key.
To be more general, in what follows, we'll refer to the value to be plotted as X
and the key-index as K
. Our waterfall graph will appear in a new variable, Waterfall_X
, defined as:
Cumulate(X, K)
Next, we need to compute the origin for each bar. We'll compute this in a variable named Waterfall_prev
defined as:
if @K = 1 then 0 else Waterfall_X[@K = @K - 1]
This states that each bar will start where the previous bar left off, with the first bar in each series starting at 0.
Show the result graph for Waterfall_X
and press the XY button on the top-right corner. Check Use another variable and add Waterfall_prev
, then press OK to close the XY comparison sources dialog.
Pivot the graph so that K
is the graph key, and your time dimension is on the horizontal axis.
Select 'Result → Graph Setup.... Set the Line Style to solid bar, place a check box on Variable origin, uncheck 'Swap horizontal and vertical, and enter Bar overlap = 0%. Press Apply.
Enable comment auto-refresher