Spotfire® User Guide

Coloring in tables, cross tables, and heat maps

For tables, cross tables, and heat maps coloring is always configured using color scheme groupings. A color scheme grouping functions as a container for one or more axis values on which you want to apply the same color scheme. In tables and cross tables, coloring can be applied either to the background of the cells, or the cell text.

Before you begin

Coloring in tables, cross tables, and heat maps must be authored in the installed client.

Procedure

  1. Open the Visualization Properties dialog, and go to the Colors page.
  2. Open the Add menu and select Color Scheme Grouping.
  3. In the Add Color Scheme Grouping dialog, type a name for the new grouping.
  4. In the Available columns list (or Available axis values depending on the visualization type), select the columns you want to include in the color scheme grouping, and click Add.
    Note: A color scheme grouping can only contain columns with values of the same data type. The exception is the five numeric data types Integer, LongInteger, Real, SingleReal, and Currency, which can be added to the same grouping. The "data type" in this case is called Numeric, but is a collection of these five data types rather than an actual data type.
  5. When all the columns you want to include have been moved to the Selected columns list (or Selected axis values depending on the visualization type), click OK to create the new color scheme grouping.
    Note: A column (or axis value) can only be included in one grouping at a time. If you add a column (or axis value) that is already included in another color scheme grouping, the column (or axis value) will automatically be removed from the other grouping.

Coloring in tables

When you create a new table visualization, it has no coloring applied to it. You must add color scheme groupings with the columns you want to color, and set up a color scheme for each of the groupings. You can add as many color scheme groupings as one per column in the table. To learn more about color schemes and how to configure them in different color modes, see Color schemes and Assigning colors to categorical or continuous data.
Tip: The table can also be styled with different text color and background color without any connection to the cell values. See Specifying text color, background color, and font style in a table.

The image below shows a table with two different color schemes applied to it.

The color schemes are separated by a horizontal line in the legend. The upper color scheme in the legend contains the two columns Category and Type, both containing string values. The lower color scheme in the legend contains the two columns Sales and Cost, both containing numeric values. The columns Year and Month are not included in any color scheme grouping. The image below shows the Colors page of the Visualization Properties dialog for the table above.

In the upper part of the dialog, the color scheme grouping "Cost and Sales" is selected, and in the lower part of the dialog, its corresponding color scheme is shown. The color scheme is in gradient color mode. The two columns share the same color scheme, but the scaling is separate for them. This means that the three color points Min, Average, and Max are calculated per column. If you want to use a common scale for the columns in the grouping, select the alternative (None) in the One scale per drop-down list. To see the scale for a column in the color scheme grouping, select it in the Color scheme groupings list. If the grouping itself is selected, as in the example, then the scale for the first column in the grouping is shown.

Coloring in cross tables and heat maps – One color scheme grouping

You can add many color schemes to the same cross table or heat map, and it is possible to color by the columns on any of the axes. However, you can only color a cross table and a heat map by one column at a time, and if the cell values axis contains more than one column, you can only color by the cell values axis. To learn more about color schemes and how to configure them in different color modes, see Color schemes and Assigning colors to categorical or continuous data.
Tip: The cross table can also be styled with different text color and background color without any connection to the cell values. See Styling in the cross table to learn more.

Example (one color scheme grouping):

The cross table below shows the sum of sales (Sum(Sales)) for fruits and vegetables for the years 2021, 2022, and 2023. The horizontal axis has the two columns Category and Type. The column Category contains the two axis values Fruit and Vegetables, and the column Type contains the values Apples, Bananas, Pears, Cucumber, Lettuce, and Tomatoes. The cross table is colored by the column Category.

When you create a new cross table, one color scheme grouping (named Numeric) is created for each column represented on an axis in the cross table. The default grouping contains all the axis values in that column. Select a column in the Color by drop-down list to see its default color scheme grouping. In the example below, a part of the Colors page of the Cross Table Properties dialog is shown. The column Category was selected in the Color by drop-down list and its default color scheme grouping is shown, as well as its two axis values Fruit and Vegetables.

In the lower part of the dialog, the color scheme for the Numeric color scheme grouping is shown. The color scheme is in Gradient color mode. The two axis values Fruit and Vegetables share the same color scheme, but the scaling is separate for them. This means that the three color points, Min, Average, and Max, are calculated per axis value. If you want to use a common scale for the axis values in the grouping, select the alternative (None) in the One scale per drop-down list. To see the scale for a column in the color scheme grouping, select it in the Color scheme groupings list. If the grouping itself is selected, as in the example, then the scale for the first column in the grouping is shown.

Coloring in cross tables and heat maps – Separate color scheme grouping

The example below shows a cross table with the same setup as in the example above except for the coloring. This cross table is colored by the column Type, and has two different color schemes applied to it.

The color schemes are separated by a horizontal line in the legend. The image below shows the Colors page of the Visualization Properties dialog for this cross table.

As can be seen in the upper part of the dialog, two color scheme groupings have been added. The first grouping is named Fruits, and the three axis values, Apples, Bananas, and Pears, have been added to that grouping. This is also the color scheme shown first in the legend above. The second grouping is named Vegetables, and it contains the axis values Cucumber, Lettuce, and Tomatoes. The Numeric color scheme grouping is empty because all the axis values in the column Type have been added to either of the two new groupings. The default grouping cannot be deleted from the list of groupings. If you delete a grouping that you have added, then the axis values in that grouping will automatically be moved to the default grouping instead. Any added groupings will be shown in the list even if you change to another column to color by. The example below shows the Color scheme groupings list when the Color by column is set to Year.

The two groupings Fruits and Vegetables are still visible, but you cannot expand them unless you change Color by back to the column Type.

Color scheme based on another expression in a cross table

Typically the color schemes for groupings in a cross table are based on the actual values that are shown in the cross table cells. However, it is possible to let a color scheme for a grouping reflect another column or expression than the one used for calculating the cell values.

To illustrate this possibility, the data below is used. The 'Budget' column shows estimated monthly figures, and the 'Actual' column the outcomes. The bar chart shows that the budget was exceeded in Q3.

Below the 'Actual' totals per quarter are shown in a cross table.

Assume quarters that exceed the budget should be distinguished in this cross table. By selecting Color the grouping using another expression, you can use another expression for coloring the selected color scheme grouping. In this example, the expression 'Sum([Budget] - [Actual])' is used, which returns a negative result if the budget is exceeded. A color rule is added that applies a red cell background, if the result of the expression is less than 0.

These settings will draw the attention to the exceeded budget in Q3.

Color scheme groupings in heat maps

Coloring in heat maps works the same way as in cross tables. The example below shows a heat map where the Y-axis is set to the column Test, while the X-axis is set to (None). The individual cell values show the average of the three columns, Time 1, Time 2, and Time 3.

The image below shows the Colors page of the Visualization Properties dialog for the heat map above. The heat map is colored by (Cell Values), which is the only available option when the cell values axis contains more than one column.