Single values channel are created to display one and only one value and/or a simple graphic.
Choose "Single value" in the layout options to make your channel a single value channel.
Use an SQL statement that fetches one and only one data row. The data row may have more than one column.
- To display a Value: the channel will use the first column with a value and with a range defined, if no range is set for any output field, will get the first column with a value.
- To display a simple graphic: the channel will use the first column with a struct.
The example above produces the following channel:
The € symbol is being set as attribute, through the via standard column attributes (Dictionary / Physical / Attributes):
1.3.1 Based on display value
Background and foreground colors of the channel can be set using the value ranges. Below there is a simple example about how this is done to make these changes depending directly on the value displayed.
To define colors according to the values range on the table, it will be necessary to define them through the table colorizer option, which must be accessed through the menu Dictionary/Physical/Attributes/Table colorized.
In this case the color palette is defined as shown.
And the result obtained is as follows.
1.3.2 Based on another value
Background and foreground colors can also be set by a hidden value. For that is needed to request a second column in the SQL query.
In this case the previous range parameters have been set to the new 'cost' column.
As a result the value displayed corresponds to the 'cost' column but its style depends on the 'sales' current value.
For this example it is used the 'Aggregate sales fact' table model.
Single graphics are created from structs SQL Statements. Check how they work here.
Channels with only a simple graph can not define ranges.The example above produces the following channel:
Both renders can be displayed at the same time. The label displayed as a title will be the value column label.
Ranges can also be defined with this channels. The example above produces the following channel:
As explained above, the structs are used to create SVG graphs that can be displayed inside the single values channels and in other places like channel tables.
Single value channel can also read another struct definition to render the market results, or at least to display as if they where from the market.
Here you can see how this graph has been created.
Note that the struct in the SQL will have the following structure:
row('b_stock', percent, leftValue, rightValue)
Bold text is required, the other is optional
leftValue and rightValue are optional, but we must define either both or none.
When only the percentage is defined the result will be like the following:
Some properties might be added in order to make this channel more customizable: this attributes are added after the 'b_stock' separed by spaces.
upIsBad: Switch the colors between good and bad colors.
bad_XXXXXX: Change the color when "bad", the 'XXXXXX' is the HEX code of the new color.
good_XXXXXX: Change the color when "good", the 'XXXXXX' is the HEX code of the new color.
So at the end the row might look something like this:
row('b_stock upIsBad bad_000000 good_FF00FF', percent, leftValue, rightValue)