Visualization spec reference

Every SmartViz chart type reads the same visualization spec, so switching chart types is a single edit rather than a rebuild. This article describes the contract behind that: the shapes, tokens, and shared behaviors every chart type honors.

For help choosing a chart type in the first place, see SmartViz visualizations.

Which settings apply where

A quick reference for which shared concepts on this page apply to which chart types.

Feature
Available on
Color rules
Line, Bar, Scatter
Mark lines / Mark areas
Line, Bar, Scatter
Label format templates
All types except Donut
Status normalization
Status grid, Health history

Example

The following example spec shows a line chart with three encoded columns, a three-color palette, one color rule (recolor any point over 90), and a mark line at the average.

Swap the chartType to "bar" and the same encoding, colors, and color rule still apply. Only the x/y shapes would need adjusting to match bar's requirements.

{
  "version": "1.0",
  "visualization": {
    "chartType": "line",
    "encoding": {
      "x": {
        "field": "timestamp",
        "type": "temporal"
      },
      "y": {
        "field": "cpuPercent",
        "type": "quantitative"
      },
      "series": {
        "field": "region",
        "type": "nominal"
      }
    },
    "style": {
      "colors": [
        "#4C6EF5",
        "#F76707",
        "#40C057"
      ],
      "cartesianColorRules": [
        {
          "gt": 90,
          "color": "#E03131"
        }
      ]
    },
    "markLines": [
      {
        "type": "average",
        "label": "Avg"
      }
    ]
  }
}

Data mapping and column types

Each chart type exposes a set of slots (the roles a column can play), such as: X axis, Value, or Label. SmartViz classifies each column in your data stream as one of three types, and only offers columns of the right type for each slot.

Column type
Meaning
Numeric
Values that can be measured and aggregated.
Time
Dates and times.
Categorical
Labels used to group or filter data, such as a name, region, or status.

Chart slots

A slot is a labeled space in a chart that only accepts one kind of column. For example, a Line chart's X Axis slot only takes a time or category column and its Y Axis slot only takes a number.

Each chart type exposes a fixed set of these, one per role a column can play. They are how SmartViz decides which columns get offered for each slot in the first place.

Optional slots include an Auto option, which lets SmartViz pick a sensible column. Required slots have no Auto option, so fill them before the chart will render.

Slot types

Every slot each chart type exposes, the column type it accepts, and whether it has to be filled before the chart will render. Bar and Line accept exactly the same slots, as do Donut and Funnel, which is why switching between either pair never needs a remap.

Note

Table (richTable) has no type-restricted slots. Its columns are mapped individually, each with its own renderer, rather than through the encoding roles every other chart type uses. See the Table visualization article's Column settings for that structure.

Every chart type’s slots, the column type each one accepts, and whether it’s required, in one table.

Chart type
Required slots
Optional slots
Bar
—
X Axis (Categorical or Time), Y Axis (Numeric), Series (Categorical or Time), Color (Categorical or Time)
Box plot
Low, Q1, Median, Q3, High (all Numeric)
X Axis (Categorical or Time)
Bullet
Value (Numeric)
Target (Numeric), Label (Categorical or Time)
Donut
Label (Categorical or Time), Value (Numeric)
—
Funnel
Label (Categorical or Time), Value (Numeric)
—
Gauge
Value (Numeric)
Min (Numeric), Max (Numeric), Target (Numeric)
Health history
Time (Time), Status (Categorical)
Label (Categorical or Time)
Heatmap
—
X Axis (Categorical or Time), Y Axis (Categorical or Time), Color / Value (Numeric)
Histogram
Value (Numeric)
—
Line
—
X Axis (Categorical or Time), Y Axis (Numeric), Series (Categorical or Time), Color (Categorical or Time)
Radar
Axes (Numeric)
Series (Categorical or Time)
Gauge list
Value (Numeric)
Max (Numeric), Label (Categorical or Time)
Sankey
Source (Categorical or Time), Target (Categorical or Time), Value (Numeric)
—
Scalar
Values (Numeric)
Label (Categorical or Time), Comparison (Numeric)
Scatter
—
X Axis (Numeric), Y Axis (Numeric), Color (Categorical), Size (Numeric)
Status grid
Label (Categorical or Time)
Status (Categorical), Statuses (Categorical), Group (Categorical or Time), Value (Numeric), Link (Categorical or Time)
Table
—
None. Columns are mapped individually, each with its own renderer.
Treemap
Label (Categorical or Time), Value (Numeric)
Parent (Categorical or Time)

Colors

Palette

The palette assigns colors to series and categories in order. Supports up to 20 colors, repeating when there are more series than colors. Defaults to the SquaredUp palette when empty.

Series / status colors

Where the palette assigns colors by position, Series / status colors pins a named value to a specific color. This is useful when, for example:

  • You want Production to always be the same color regardless of sort order.
  • You want to color status values explicitly.

Pins a named series, category, or status value to a specific color, independent of its position in the palette.

Color rules

Available on line, bar, and scatter charts, color rules recolor data based on conditions. Give each rule a color plus one or more conditions; a rule with no conditions is ignored.

Condition
Description
>
The value to compare against. Matches when the data point is greater than it.
≥
The value to compare against. Matches when the data point is greater than or equal to it.
<
The value to compare against. Matches when the data point is less than it.
≤
The value to compare against. Matches when the data point is less than or equal to it.
Series
The series name this rule is scoped to.
Label
The exact label this rule is scoped to.
Contains
Text the label must contain for this rule to match.
Series #
The series position, counting from 0, this rule is scoped to.

Example: a rule with condition > set to 90 and Series set to CPU, colored red, recolors any CPU data point above 90.

Mark lines and mark areas

Available on line, bar, and scatter charts, the only chart types built on a cartesian (x/y) encoding. Other chart types have no axis for a reference line or band to attach to.

A mark line draws a horizontal reference line, set to a statistic calculated from the data (Average, Median, Min, or Max) or a custom value. Each line takes an optional label and color.

Example: a mark line set to Average with label "Avg" draws a line at the mean of the plotted values.

A mark area shades a band of the chart, bound to either axis, running from Min or a custom value to Max or a custom value. Each area takes an optional label and color.

Example: a mark area on the Y axis, from a custom value of 80 to Max, colored amber, shades the region above 80.

Label format templates

Several visualizations accept an Expression for their data labels or tooltips. Templates can reference:

The date, number, and percent helpers are available inside templates. See Expressions for the full syntax.

Note

Donut is the exception: it doesn’t read a label template at all. It uses its own Label Content setting (Name, Value, Percent, or None) instead.

Token
Meaning
{{value}}
The data point's value.
{{name}}
The data point's name or category.
{{percentOfTotal}}
The value as a percentage of the total, where applicable.
{{<column name>}}
Any column in the data stream, by name.

Status normalization

Status grid and health history color their marks by health state. If your data uses its own status strings, such as degraded_performance or partial_outage, use Status normalization to map each raw value onto one of the built-in health states:

  • Unmonitored
  • Unknown
  • Success
  • Info
  • Warning
  • Error

Any value you do not map falls back to Unmonitored (gray), the same neutral state SquaredUp uses elsewhere for data with an unknown health status.

For example, mapping degraded_performance to Warning and partial_outage to Error means either raw value renders with the matching health-state color everywhere status is shown.

Was this article helpful?


Have more questions or facing an issue?