Spotfire® User Guide

Coloring in tables, cross tables, and heat maps

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

About this task



Adding coloring groups using the contextual visualization properties panel

About this task

Tip: You can accomplish the same coloring by configuring visualization properties using the dialog in the installed client, but the steps are slightly different. To see examples on how configuration can look when doing it from the visualization properties dialog, see a previous version of the user guide.


Procedure

  1. Open the Visualization properties panel, and expand the Colors card, or select Add > Colors if it is not already added. For heat maps, a default coloring is applied as soon as you add the visualization, while tables and cross tables have no coloring applied from start.
  2. For cross tables and heat maps, select an option in the Define coloring for drop-down list. You can select (Cell values), or any column that is used on either of the other axes in the visualization (X-axis and Y-axis in a heat map, or Row axis and Column axis in a cross table). If the cell values axis contains more than one column, you can only color by the cell values axis, and therefore do not have to make a selection.
  3. Click Add group at the bottom of the card. If you are working with a table, and your data contains different data types, you will be asked to select the type of data for the group.
    Note: The reason you need to specify the type of data for your group is because a coloring group 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 it is a collection of these five data types rather than an actual data type.
  4. In the Available columns list (or Available axis values, depending on the visualization type), select the columns to include in the group, and click Add.
  5. When all the columns or axis values you want to include have been moved to the Selected columns list (or Selected axis values, depending on the visualization type), specify a name and click OK to create the new coloring group.
    Note: A column (or axis value) can only be included in one group at a time. If you add a column (or axis value) that is already included in another coloring group, it will automatically be removed from the other group.

Results

The new group is added to the card under Coloring groups. A default color configuration is applied for the group and can be seen in the visualization. For more details about the specific visualization types, see below.

You can also add color rules for even more specific coloring.

Coloring in tables

When you create a new table visualization, it has no coloring applied to it. You must add coloring groups (or color scheme groupings in the visualization properties dialog) with the columns you want to color, and set up a color scheme for each group. You can add as many groups 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.

Example

The example below shows a table with two different coloring groups, with two different color configurations, or color schemes. In the panel to the right, the Colors card is shown, with the two groups listed under Coloring groups.

In the table above, the legend shows the two color schemes separated by a horizontal line. The upper color scheme belongs to the group that is called "Category and type" which contains the two columns "Category" and "Type". Both columns have string values, which is indicated by the icon next to the name of the group in the panel. The lower color scheme belongs to the group "Cost and Sales" which contains the two columns "Sales" and "Cost", both with numeric values. The columns "Year" and "Month" are not included in any group, and therefore have no coloring applied to them.

Tip: Hover over the icon next to the coloring group name to see more information, if you are uncertain what type of data the icon represents.

In the panel, the coloring group "Cost and Sales" is expanded, and its color configurations are shown. Under Columns in this group, the two columns "Sales" and "Cost" are listed. The color scheme is in gradient color mode, and 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 group, select the alternative (None) in the One scale per drop-down list. In the example above, coloring is applied to the background of the cells in the table, and there are no rules.

If you want to see details about what this example would look like when configuring it from the visualization properties dialog instead of the contextual panel, see a previous version of the user guide.

About this task

Coloring in cross tables and heat maps

About this task

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.

If you want to see details about what these examples would look like when configuring it from the visualization properties dialog instead of the contextual panel, see a previous version of the user guide.

Example (one coloring group):

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 uses Define coloring for "Category".

When you create a new cross table or heat map, one default coloring group is created for each column represented on an axis in the visualization. The Default group contains all the axis values in that column. Select a column under Define coloring for in the contextual properties panel to see its default coloring group. In the example above, a cross table and a part of the Colors card for the visualization is shown. The column "Category " was selected in the Define coloring for drop-down list, and its default coloring group ("Default group (Numeric)") has been expanded to show the two axis values "Fruit" and "Vegetables", as well as the current color configurations for the group.

The current color mode used is "Gradient". 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.

Example (separate coloring groups):

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 a part of the Colors page of the visualization properties panel for this cross table, with the Vegetables group expanded.

As can be seen in the upper part of the image, two coloring groups have been added (after the default group). The first group is named "Fruits", and the three axis values, "Apples", "Bananas", and "Pears", have been added to that group. This is also the color scheme shown first in the legend in the visualization image above. The second group is named "Vegetables", and it contains the axis values "Cucumber", "Lettuce", and "Tomatoes". The Default group (Numeric) coloring group is empty because all the axis values in the column Type have been added to either of the two new groups. The default group cannot be deleted from the list of groups. If you delete a group that you have added, then the axis values in that group will automatically be moved to the default group instead. Any added groups will be remain in the list until you remove them, even if you switch to define coloring for another column. The example below shows the Coloring groups list if Define coloring for is switched to "Year".

The two groups Fruits and Vegetables are still visible, but there will not be any items in them unless you change Define coloring for back to the column Type.

Color scheme based on another expression in a cross table

About this task

Typically, the color schemes for groups 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 group 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 using separate expression, you can use another expression for coloring the selected coloring group. 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.

Tip: You can set the color mode to "Transparent", and only apply coloring based on rules within a coloring group for a cross table.
These settings will draw the attention to the exceeded budget in Q3.

Coloring groups in heat maps

About this task

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 card of the visualization properties panel 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, and the scale is the same for all axis values (One scale per is set to "(None)").

If you want to see details about what these examples would look like when configuring it from the visualization properties dialog instead of the contextual panel, see a previous version of the user guide.