How to set a custom color scheme for a particular column.

How to set a custom color scheme for a particular column.

book

Article ID: KB0077736

calendar_today

Updated On:

Products Versions
Spotfire Analyst All Versions

Description

When using Property Controls and Custom Expressions to define the "Color by" axis in visualizations, normally the color scheme is reset any time the column or expression is changed in the "Color by" axis. It is possible to define a custom Color Scheme and assign that to a particular column, so that the custom Color Scheme is applied whenever that column is selected.

Limitations:
This will not work if some of the columns that can be selected in the Property Control to drive the "Color by" axis have a "Color by" mode of "Continuous" and others have a "Color by" mode of "Categorical." This is because changing the Property Control's drop-down value does not shift the visualization's "Color by" mode between "Continuous" and "Categorical," as selecting a column in the visualization's own "Color by" axis does.

Issue/Introduction

How to set a custom color scheme for a particular column.

Resolution

  1. For each column you will be coloring by (all in the drop-down), save your colors as a 'Document Color Scheme'
      a. Select column from the property control drop-down (for example 'MyFirstColumn').
      b. Change the "Color By" colors as desired (either via Legend or via visualization > Properties > Colors).
      c. Right click on your visualization > Properties > Colors > Click the 'Color Schemes' button (To the right of the 'One scale per' drop-down) > Save as > Document Color Scheme...
      d. Use a name like 'MyFirstColumn_Color'.
  2. Define this color scheme as the default for this column
      a. Go to Edit > Column Properties > Select the Data Column in question (for example 'MyFirstColumn').
      b. Go to the Properties tab > Edit the 'DefaultCategoricalColorScheme' or 'DefaultContinuousColorScheme' Property for that column (depending on whether your column is categorical or continuous).
      c. Add in the value that matches the Document Color Scheme you saved earlier (for example, 'MyFirstColumn_Color').
      d. Click OK (twice) to save all changes.

Now when you change the column or expression in your visualization to the columns defined in the process above, their own custom color scheme will be applied, instead of the default color scheme.

See the referenced documentation for more explanation of these properties:

  • DefaultContinuousColorScheme
    • The name of the default continuous color scheme that will be used when continuous coloring is applied to this column. If no color scheme is specified, or if the specified color scheme is not available, the Spotfire Continuous color scheme will be used.
  • DefaultCategoricalColorScheme
    • The name of the default categorical color scheme that will be used when categorical coloring is applied to this column. If no color scheme is specified, or the specified color scheme is not available, the Spotfire Categorical color scheme will be used.

Additional Information

Doc: Column Properties Descriptions