TIBCO Cloud™ Spotfire® Web Client User Guide

Creating a stacked bar chart

In a stacked bar chart, the bars are split into colored bar segments placed on top of each other. The total height of a bar shows the numerical value for a certain category, and the heights of the bar segments represent how different components contribute to that value.

About this task


Stacked bar chart with axes
For information about the simplest bar chart, that is, a bar chart without colored segments, see Creating a bar chart.

In a stacked bar chart, the Color axis in the legend is one of the main axes in addition to the Value and Category axes described in Creating a bar chart. The Color axis is used to split the data in the different categories on the Category axis into further categories.

Another display option of bar charts with bar segments is a side-by-side bar chart, see Creating a side-by-side bar chart. In a side-by-side bar chart, you can easily compare the heights of the bar segments, because they are placed next to each other.

The categories, or segments, into which a bar is split can be of different types as illustrated below: entire columns that you want to compare, or categorical values within a column.


Comparing column and column values

Depending on what you want the bar segments to represent, you create a stacked bar chart in different ways.

Comparing data columns

Procedure

  1. On the authoring bar, click Visualization types to open the flyout.
  2. Drag the Bar chart visualization type to the wanted position on the analysis page.
    A suggestion of a bar chart is presented.
  3. On the Value axis, select the columns whose numerical values you are interested in comparing.
    The bars are split into stacked segments, colored differently. The Color axis in the legend is set to (Column Names), which means each selected column is represented by segments in a specific color.
  4. For each of these selected columns on the Value axis, select which type of aggregated value to display.
  5. On the Category axis, select the column containing the categories each bar should represent.

Example

Assume the data table below is loaded. It contains electronics and toys purchases made by customers at different store locations. Gender is also registered.


Bar chart table

See the settings made to examine differences in purchases made at different store locations. The total sums of electronics and toys purchases can be viewed as well as the electronics and toys contributions to the total sum at each location.


Bar chart comparing columns

Comparing categories within a column

Procedure

  1. On the authoring bar, click Visualization types to open the flyout.
  2. Drag the Bar chart visualization type to the wanted position on the analysis page.
    A suggestion of a bar chart is presented.
  3. On the Value axis, select the column whose numerical values you are interested in comparing.
  4. Select which type of aggregated value to display for the selected column.
  5. On the Category axis, select the column containing the categories each bar should represent.
  6. On the Color axis in the legend, specify the column containing the categories the bar segments should represent.

Example

Assume the data shown in the example above is loaded. See the settings made to display electronic purchases made by men and women, respectively, at different store locations.


Stacked bar chart colored by column categories