scalar

Scalar, built-in table

The Scalar table has exactly one line. Any variable without an explicit table prefix belongs to Scalar.

a = 1
b = "hello"

table T = extend.range(3)
T.X = a + T.N

show table "Scalar broadcast" with
  T.N
  T.X

This outputs the following table:

N X
1 2
2 3
3 4

The Scalar table cannot be filtered with where or when.

scalar, tile type

The scalar tile is created with show scalar:

show scalar "Revenue" { 1..4, 1..3; unit: "$" } with 1234

Besides numbers, dates, text, and booleans, a scalar tile can also display ranvar and zedfunc values (as a histogram or plot).

Examples

Label position, alignment, and text size can be controlled independently of the value. The second KPI below puts its label below the value and overrides only the value’s color.

comparison = show region { 1..8, 1..9 }

show scalar "Inventory value" { 1..6, 1..3 in comparison;
  size: 0; scalarLabelPosition: above; textAlign: left; textColor: blue
} with
  12345.67 { numbers: simple; unit: "$"; precision: 2; minPrecision: 2 }

show scalar "Inventory value" { 7..12, 1..5 in comparison;
  size: 2; scalarLabelPosition: below; textAlign: right; textColor: blue
} with
  12345.67 { numbers: simple; unit: "$"; precision: 2; minPrecision: 2; textColor: "green/700" }

Number formatting changes the display without changing the underlying value. The first two tiles below contain the same amount: the first uses numbers: millions, and the second uses numbers: simple. The last tile displays the ratio 0.945 as 94.5%; it does not require multiplying by 100.

formats = show region { 1..6, 1..14 }

show scalar "Amount in millions" { .., 1..3 in formats; textAlign: left } with
  1234567.5 { numbers: millions; unit: "$"; precision: 2; minPrecision: 2 }
show scalar "Full amount" { .., 5..7 in formats; textAlign: left } with
  1234567.5 { numbers: simple; unit: "$"; precision: 2; minPrecision: 2 }
show scalar "Fill rate" { .., 9..11 in formats; textAlign: left } with
  0.945 { numbers: percent; precision: 1; minPrecision: 1 }

precision limits the displayed decimal places, and minPrecision retains trailing zeros up to the requested number of places. A unit adds a unit label; numbers: percent performs the percentage display conversion.

StyleCode

In region-based dashboards, the tile scope includes the label; the entry contains the displayed value. A value-level declaration can override a property inherited from the tile.

The legacy dashboard attachment points are listed below.

For generic StyleCode rules, see stylecode.

User Contributed Notes
0 notes + add a note