Gradient Column Style

Summary

  • The Gradient Column Style is used to style all cells in a Column based on a provided Gradient
  • Each cell is coloured according to its value relative to a provided Min and Max number
  • These Min and Max numbers can be set for the whole Column or in Ranges
  • Each set of Min and Max numbers can be hardcoded or based on the values in another Column

The Gradient Style applies dynamic styling to a Numeric Column.

Each cell is coloured according to a gradient value.

This is calculated in relation to a provided minimum and maximum value.

These minimum and maximum values can use either Ranges or a Column Comparison.

Caution

Gradient Columns can only be applied on Format Columns which have a Scope of a single, numeric Column

Ranges

A Range is used to define a set of cells. It has 3 properties:

  • a minimum value
  • a maxium value
  • an associated colour

Each cell in the column is coloured using the cell value against the range's boundaries.

The minimum and maximum values in a Range can themselves be provided in 2 ways:

  • a hardcoded value
  • using Col-Min or Col-Max to dynamically determine the Column's Minimum or Maximum values

Note

  • Col-Min or Col-Max values re-evaluate in real time in response to data changes
    • e.g. if a cell ticks and now becomes the Column's highest value, all the cells will re-render

There is no limit on how many ranges can be created.

Percentage Ranges

By default Ranges are Numeric, i.e the Range values are numbers (either hard-coded or dynamically derived). But there is an option to create Ranges where the values are Percentage, rather than Numbers.

Caution

  • The percentage calculation is based on the cell value as a percentage of all the values in the column
  • It is not calculated using the number of cells in the column - that is not part of the evaluation
Gradient Style
Fork
  • This example has 4 Columns provided with a Gradient Column Style:
    • Open Prs has a single Range in purple - using hard-coded values
    • Closed Issues has 3 Ranges - in Red, Orange and Green respectively
    • Open Issues has a single Range in blue - using Col-Min and Col-Max
    • Closed Prs has 2 Ranges - in Brown and Gray that use Percentages (1-20, 20-100)

Expand to see the Gradient Style Definitions

Reversing the Gradient

By default a Gradient will display higher numbers darker than lower ones. Sometimes, however, the preferred behaviour is for lower numbers in the Range to display darker.

Hint

A common use case is negative numbers where users want the Gradient to be darker the lower the number

Gradient Style: reversed
Fork
  • This example shows a Column with a Reversed Gradient Style:
  • Issue Change has 2 ranges:
    • one for negative numbers in Red - between Col-Min and 0. It uses a Reverse Gradient so the numbers are darker the lower they are
    • one for positive numbers in Green - between 0 and Col-Max
  • We have sorted on the Column also to display this effect more easily

Expand to see the Gradient Style Definitions

Column Comparison

Alternatively, the Gradient Style can render using a Column Comparison. This compares each Cell Value to that of another, defined, column in the row.

Hint

This is useful if you want to colour the Gradient using the cell Value as a % fill of another column's value

Gradient Style: Column Comparison
Fork
  • The Open Issues Column has been given a (purple) Gradient Column Style that uses a Column Comparison with the Closed Issues column

Expand to see the Gradient Style Definitions

Formatting Gradient Columns

The cell value that is displayed inside a Gradient Column can be formatted like any other cell. Any Styles or Display Formats provided in Column Formatting will be applied to the cell.

Caution

The only exception is the BackColour property which will be ignored since that is derived from the Gradient Column

Gradient Style: Formatting
Fork
  • In this example we provided a Gradient Column Style for the Github Stars Column
  • We also styled that Column to be centre-aligned and show a Numeric Display Format
  • Additionally we provided a Conditional Style so that cells which are greater than 100K display a Fore Color of Gray and Bold

Expand to see the Gradient Style and Format Colummn Definitions

Defining Gradient Columns

Gradient Column Styles can be created at design-time via Styled Column Initial Adaptable State.

Creating Gradient Columns

Gradient Column Styles can be created at run-time using the Styled Column UI wizard.

UI Step by Step Guide

Creating a Gradient Column Style using the Styled Column Wizard

FAQ

Can I switch the direction of the Gradient? Yes, set ReverseGradient to true and the cell’s gradient will be darker the lower the cell value

Can we create a Gradient Style that spans multiple columns? Not at the moment - Gradient Style works on a single column only. However we do have an Enhancement Request for a Heat Map style which will include multiple columns, which we hope to introduce in the near future.