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.
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.
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.
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.
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.
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.
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.
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:
UnmonitoredUnknownSuccessInfoWarningError
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.