Stack Graph for Categories
When to use a stack graph for categories
A stacked graph is meant for visualizing the total change over time of a group of quantities. Because items are "stacked," this type of graph is especially useful when it makes sense to add up the underlying data points. For example, a stacked graph is good for sales data, since you may be interested not only in sales of individual items but also want to know how total sales vary over time. For simple data sets you may be able to use a simple stack graph. But if your data items are arranged into categories and subcategories, it makes sense to use a stack graph for categories.
How a stacked graph for categories works
The Many Eyes stacked graph for categories is shown below.
Each ribbon of color in the graph represents a data item changing over time. In this graph the ribbons represent United States government spending on different budget items. The height, or thickness, of each ribbon represents the dollar figure for spending. The overall height of the graph shows the total spending.
In many data sets, such as this one, items are arranged into categories and subcategories. The tree outline at left provides a color key to these categories. It allows lets the user drill down into the data by expanding and collapsing categories. As the user drills down, the color scheme will adjust so that there is always a wide range of colors in the graph. The tree control itself contains tiny "sparkline" graphs that show the trend for each subcategory and category.
The "percentage" checkbox will adjust the graph so that each ribbon shows the percentage of the total for that point in time, rather than an absolute number. This option is helpful for emphasizing the relative sizes of the ribbons.
Data requirements
A stacked graph requires a somewhat complex data table. To create the categories and subcategories, Many Eyes will look at all the text columns, in order from left to right. The leftmost text column will be used for the highest-level category, the next for the level below that, and so on. Numeric columns will be used for the values of the graph, again in order from left to right.
An example data set suitable for a stacked graph is:
| Type | Food | 2000 | 2001 | 2002 | 2003 |
|---|---|---|---|---|---|
| Fruit | Banana | 1456 | 1456 | 1456 | 1456 |
| Fruit | Lemon | 23 | 23 | 23 | 23 |
| Fruit | Orange | 981 | 981 | 981 | 981 |
| Meat | Pork | 111 | 111 | 111 | 111 |
| Meat | Beef | 442 | 442 | 442 | 442 |
| Meat | Chicken | 1456 | 1456 | 1456 | 1456 |
Important: The numbers in the value column should not be negative, since the stacking technique in the graph would no longer make sense. Negative values will be treated as zeros.