The Table Colorizer feature is a grid parameterization for colorizing grid cells depending on its content, generally to emphasize the importance of a cell amoung a group of cells.

1 Introduction

1.1 What is it?

Table Colorizer is a tool to make grids easier to analyze at a glance.

Let's see an example of a simple grid with a table colorizer definition assigned:

As it looks, due to the colors of the grid, it becomes very easy to see which values ara bigger and which ones are not.

In addition, depending on the dataset that we want to deal with, there are different algorithms to deal with this data, and thus color the grid in the best possible way.

1.2 What can I do?

Table Colorizer are mainly focused on the colorization of grids, such as those containing SQL Tables or grids contained in Channels.

Its use is interesting when:

  • The dataset contains numeric values to be classified
  • The dataset contains discrete values (numbers or strings) from which we want to obtain the frequency of appearance

The best thing of Color Palette is that it's very easy to colorize the grid, just by indicating a palette of colors and one of the defined algorithms we have enough. At the same time, it can be added complexity to the colorizer with the use of ranges.

1.3 What do I need?

In first place, Table Colorizer requires the basic Axional Studio infrastructure, which includes:

  • Axional Studio Server, properly set up.
  • Dictionary database
  • A target database
The previous configuration is explained in detail under the Axional Studio/Installation block.

In second place, as they can be applied to SQL Tables in Axional Studio Form Object, it is required to have any object that uses an SQL Table with at least one column for which a table colorizer is defined. And the same to Channels.

2 Architecture

2.1 Structure

                                
Loading...

2.2 Dictionary tables

Table Colorizer implementation involves four parametrization tables:

  • Table colorizer definition (wic_jdic_color_rule_def)
  • Color palette (wic_jdic_color_palette)
  • Table colorizer ranges (wic_jdic_color_rule_range)
  • Labels (wic_jdic_lbldata)

As it is explained below, Table Colorizer functionalities only requires always the table wic_jdic_color_rule_def; It will be explained when is necessary to use the other tables below.

2.2.1 Table colorizer definition

Menu path:
Dictionary / Physical / Attributes / Table colorizer
wic_jdic_color_rule_def
Label Description
Code

Unique identifier of the color rule definition.

Description

Functional description of the color rule definition.

Consider all columns

Flag indicating which columns the colorizer considers for calculating the limits (Max, Min, etc).

  • If zero, it considers a single column.
  • Otherwise, considers all the columns of the grid with the same color rule definition.


  • Default: 0
  • Values:
    • 1: Yes.
    • 0: No.
Method

Method for determine the color to apply to a cell.

  • [0] Simple distribution
  • [1] Quartiles distribution
  • [2] Repetitions
  • [3] By Rank


  • Default: 0
  • Values:
    • 0: Simple distribution.
    • 1: Quartiles distribution.
    • 2: Repetitions.
    • 3: By rank.
Gradient

Flag to determine if consider the palette colors as final values, or use them to create a gradient.



  • Default: 0
  • Values:
    • 1: Yes.
    • 0: No.
Palette

List of colors to applied. It's required if the method used is:

  • Simple distribution
  • Quartiles distribution
  • Repetitions

Validates to wic_jdic_color_palette.pal_code

Show histogram

Flag indicating if the header has a frequency histogram with a tooltip caption.



  • Default: 0
  • Values:
    • 1: Yes.
    • 0: No.

2.2.2 Color palette

If the method defined in a color rule definition is 'Simple distribution', 'Quartiles distribution' or 'Repetitions', another table to obtain the color palette will be needed:

Menu path:
Dictionary / Physical / Attributes / Palette of colours
Channels / Palette of colours
wic_jdic_color_palette
Label Description
Code Identifier code of palette
Name Name of palette
Colors Colors of palette

2.2.3 Table colorizer ranges

If the method defined in a color rule definition is 'By rank', another table to define the ranges will be needed:

wic_jdic_color_rule_range
Label Description
Id

Join with wic_jdic_color_rule_def.rule_code

Order

Indicate the order to execute the range expressions.

Main color

Main color to be applied to the cell, in case the expression returns true.

It should contain a value such as #00FF00



  • Default: #FFFFFF
Secondary color

Secondary color to be applied to the cell, in case the expression returns true.

It should be a contrast color in relation to the main color, to guarantee a correct visibility.

Generally, corresponds to the text color.

It should contain a value such as #00FF00



  • Default: #000000
Expression

UEL Expression which determine whether apply the current color or not. It must return a boolean value:

  • If true the current color is applied.
  • Otherwise, it is expected to apply the color of other item.
  • In case of any item for the given palette is applicable, its not set any color.

In order to give the maximum means for create versatil expressions, the system provides the following variables to the expression evaluator:

  • value: correspond with the value of the cell the color might be applied.
  • totalitems: the number of items, or colors, available for the current pallete.
  • Continuous values
    • max: the maximum value of the dataset considered for the palette application.
    • min: the minimum value of the dataset considered for the palette application.
    • avg: the average value of the dataset considered for the palette application. That is, the result of adding up all the values considered in the dataset and diving by the number of values.
    • med: the median value of the dataset considered for the palette application. That is, the value separating the higher half from the lower half of a dataset.
  • Discrete values
    • repeat_value: Is the number of repetitions of the current value.
    • repeat_max: Is the maximum number of repetition for any value.
    • repeat_min: Is the minimum number of repetition for any value.


  • Format: UELSQL_EXPR
Label

Label describing the color functional meaning. It might be used in palette legend.

It's value validates with wic_jdic_lbldata.label_code

The table has not a parametization object to do transactions, but in wic_jdic_color_rule_def it is possible to define the ranges when the selected method is 'By rank' with a transactional SQL Table.

2.2.4 Labels

When the table colorizer has ranges defined, it is possible to set a label to the ranges with information about the range expression, to be shown on the tooltip legend.

Menu path:
Dictionary / Logical / Labels
wic_jdic_lbldata
Label Description
Language Language associated to the tag

  • Default: es
  • Case: Downshift
  • Values:
    • SELECT: .
Verified It specifies if the text has been checked by an expert or translator.

Never mind the current status, automatic processes will not affect it.

  • Default: 0
  • Values:
    • 1: Yes.
    • 0: No.
Code Tag code
Description

Description of the label in the indicated language. This description will be the one that is presented, dynamically and automatically, in the definition and construction of system forms.



Information Extended information

User created User that has created the object

  • Default: USER
Date created Creation date

  • Default: CURRENT
User updated User updated

  • Default: USER
Date updated Updated date

  • Default: CURRENT

3 Implementation

The implementation of Table Colorizer is achieved by adding some color rule definitions to the desired columns in a table.

The implementation of Table Colorizer is defined by one entity:

  • Table colorizer definition (wic_jdic_color_rule_def)

The former defines the colorizer rule, and according to this rule involve another entities like table colorizer ranges (wic_jdic_color_rule_range) or color palettes (wic_jdic_color_palette).

3.1 Table colorizer definition

The Table colorizer definition contains all the necessary information to colorize a column of a table. Each colorizer definition is identified by a unique code, that can be use by more than one column in a table.

3.1.1 Defining a table colorizer

To start defining our colorizer, the following values will be indicated:

  • Description (not required)
  • Consider all columns
  • Show histogram
  • Method
  • Palette
  • Gradient

Description

The Description contains the functional description of the color rule definition. It is not required.

Consider all columns

The Consider all columns flag indicates which columns the colorizer considers for calculating the limit values like max, min, average, etc.

It can contain two values:

  • 0 (false): It considers a single column.
  • 1 (true): It considers all the columns of the grid with the same color rule definition.
Example

If the flag is activated and all the columns of the table have the same color rule definition, the resulting grid will be the following:

Otherwise, if the flag is not activated, the resulting grid will be the following:

Show histogram

The Show histogram flag indicates if the header of the column will have a frequency histogram with a tooltip caption.

Example

If the flag is activated in all the columns of the table, the following histograms will appear below the header:

Also, if we go over the histogram, a tooltip with the caption will appear:

The implementation of Table Colorizer is achieved by adding some color rule definitions to the desired columns in a table. According to this configuration, the system handles two ways to colorize:

  • By algorithm method: The user indicates a method to colorize automatically the grid.
  • By ranges: The user indicates some ranges to colorize the grid according to the validation of certain expressions that can involve limit values, for example.

By algorithm method

The Color rule definitions contain the following automatic grid colorization algorithms:

  • For continuous values:
    • Simple distribution
    • Quantiles distribution
  • For discrete values:
    • Repetitions
Simple distribution

Simple distribution algorithm distributes the data of the dataset by ranges with an amplitude determined by the following formula:

$$Amplitude = {max - min \over groups}$$

This algorithm calculates the groups considering the range of the dataset, giving very good results when a large part of the data tend to be close to the arithmetic mean. Otherwise, it does not plow a good distinction when the are extreme data in out dataset.

Example

This is a dataset with the following values:

  • Max: 8000
  • Min: 0
  • Groups: 10
  • Amplitude = 800

This is the resulting grid when it is applied the simple distribution algorithm to this dataset:

The distribution of the values by groups will be the following:

  • 0 - 800: 90,83 %
  • 801 - 1600: 8,33 %
  • 7201 - 8000: 0,83 %

In conclusion, for this dataset is it not appropaite to apply this distribution algorithm.

Quantiles distribution

Quantiles distribution distributes the data of the dataset in groups of equal size. Its use is recommended when our dataset contains many extreme values (very far from the arithmetic mean).

Example

This is the resulting grid when it is applied the quantiles distribution algorithm to the same dataset as the previous example:

In this case, when creating groups with the same number of data, the interpretetion of data is better than with the simple distribution algorithm.

Repetitions

Repetitions algorithm distributes the data of the dataset according to the absoute frequency of each discrete value. Its use is indicated when it is important to know what values are repeated more or less.

Example

This dataset contains the most polluted cities in Europe for the last 20 years* (each row contains 6 cities, the most polluted cities every 2 months in that year).

This is the resulting grid when it is applied the repetitions algorithm to this dataset:

With this example is easy to see what cities were the most and the least polluted cities for the last 20 years.


*The data shown is not real

When one of these algorithms is being applied, there are two more values of the color rule definition that have to consider:

  • Color palette
  • Gradient
Color palette

The Color palette defines the list of colors to be applied on the grid. This code validates to pal_code in table wic_jdic_color_palette.

Only available in working dictionary

The available colors palettes are those of the current dictionary. This is not a multidictionary option.
Gradient

The Gradient flag determines if consider the palette colors as final values, or use them to create a gradient. It will also determine the number of groups in which the dataset will be divided.

Example

This palette contains the following colors:

Color Hex
#55ff55
#ff5555

In the case that gradient flag is not actived, only the two colors indicated on the palette will be applied, an therefore the number of groups will be 2.

Otherwise, if gradient flag is activated, the system will calculate the number of groups with a mathematical formula.

Imagine that in this case the result is 10. Then, the groups will have the following colors:

Color Hex
#55ff55
#68ec55
#7bd955
#8ec655
#a1b355
#b3a155
#c68e55
#d97b55
#ec6855
#ff5555

By ranges

When the goal is to colorize the dataset in our own way, it is best to use the By rank method.

The Color rule ranges contains the necessary fields to indicate how to manually colorize a grid. Each colorizer range is identified by the unique code of its parent wic_jdic_color_rule_def.

To define the ranges, the following values will be indicated:

  • Order (not required)
  • Main color
  • Secondary color
  • Expression
  • Label (not required)
Order

Order indicates the order to execute the range expressions. The first ordered expression that is fulfilled will be the one that will be applied to the data. It is not required.

Main color

Main color to be applied to the cell, in case the expression returns true. It shoud contain this types of colors:

  • HTML Colors (RED, BLUE, WHITE, etc.)
  • Hexadecimal Colors (#FF0000, #54AB19, #000, etc.)
  • RGB Colors (rgb(255,255,255), rgba(0, 120, 120, 1), etc.)
Secondary color

Secondary color to be applied to the cell, in case the expression returns true. Corresponds to the text color. It should contain a type of color like the main color.

It should containt a contrast color in relation to the main color, to guarantee a correct visibility.
Expression

The UEL Expression will determine whether apply the current color or not. It must return a boolean value:

  • If true, the current color is applied.
  • Otherwise, it is expected to applu the color of another item.
  • In case of any item for the given palette is applicable, it is not set any color.

In order to give the maximum means for create versatil expressions, the system provides the following variables to the expression evaluator:

Variable Definition
value Correspond to the value of the cell the color might be applied.
totalitems The number of items available for the current dataset.
Continuous values
max The maximum value of the dataset.
min The minimum value of the dataset.
avg The mathematical mean of the dataset.
med The median value of the dataset.
Discrete values
repeat_value Is the number of repetitions of the current value.
repeat_max Is the maximum number of repetitions of the dataset.
repeat_min Is the minimum number of repetitions of the dataset.
Variables for continuous values will not work if the dataset has discrete values. The user has to take charge of using the appropriate variables so that the colorizer takes effect.
Label

Label describing the color functional meaning. It will be used in tooltip caption. Its value validates with label_code in wic_jdic_lbldata. It is not required.

Example

If the Show histogram flag is activated and almost a label is applied to a range of the color rule, the label will appear on the tooltip caption.

3.2 Table colorizer applications

3.2.1 Applying a colorizer to a SQL table

Once having the necessary color rule definitions to colorize our tables is the time of telling each column what color rule definition will use.

To do this, indicate the color rule definition rule_code in the out_palette field of the SQL table columns.

Remember that when the Consider all columns flag is activated in a color rule definition, it will consider the dataset of all the columns of the table that have the same color rule.

Only available in working dictionary

The available color rule definitions are those of the current dictionary. This is not a multidictionary option.

3.2.2 Applying a colorizer to channels

Once having the necessary color rule definitions to colorize our tables is the time of telling each column what color rule definition will use.

To do this, indicate the color rule definition rule_code in the out_palette field of the SQL table columns.

Remember that when the Consider all columns flag is activated in a color rule definition, it will consider the dataset of all the columns of the table that have the same color rule.

Only available in working dictionary

The available color rule definitions are those of the current dictionary. This is not a multidictionary option.

4 Samples

The following section presents a set of samples with the most interesting cases of uses of Axional Studio Table Colorizer implementations:

4.1 Heat map of a CPU usage per hour

4.1.1 Introduction

This sample shows how to implement a defined Table Colorizer in a SQL Table.

The current sample is based on the following data structure:

                                
Loading...

As observed, a table with a date and information per hour about the CPU usage of a server contains our dataset.

The following SQL Table shows the content of the table:

After seeing this table, it is apparent that with colors in this table it would be much easier to see when the server is in a critical state of work. That is why it is important to apply a colorizer to the table.

4.1.2 Defining a table colorizer

The color rule definition parametrization for that case consist on:

Column Value
Code CPU
Description Color rule to colorize the CPU usage of a server
Consider all columns true
Show histogram true
Method Simple distribution
Palette cpu_1
Gradient true
The color rule definition considers all columns because the table work with percentages, so all the columns will contain the same data spectrum.
The simple distribution method has been chosen because by working with the same data spectrum (0% - 100%) all the values will be closer to the arithmetical mean.

And the color palette assigned to this color rule definition have these colors:

Color Hexadecimal color
#70b58a
#fec444
#fbb050
#f89d5b
#f48967
#f17572
The goal of having only one green color in the palette and a gradient from orange to red in 5 colors is that only very low values are considered good.

4.1.3 Applying a colorizer to a SQL table

Once color rule definition is defined, this definition is assigned to the necessary columns of the SQL Table.

Since Consider all columns is actived in the color rule definition, the same definition applied to various columns will have the same dataset.
Remember not to assign any color rule definition to column date, this would generate an error to our dataset.

4.1.4 Execution

Once color rule definition is defined and assigned to the columns of the SQL Table, the grid will be automatically colorized every time it is generated, and in this case it will be shown as: