Skip to main content
A highlight emphasises the observations that match a predicate by de-emphasising the ones that don’t. You describe what to match — not which pixels to paint — so the highlight tracks the data through re-sorts, filters, and updates.

Predicates

The first argument to highlight() is a predicate — a test against your post-transform columns. Field predicates name a variable and a comparison:
Ordered operators (gt, gte, lt, lte, range) need a numeric or date column. Using one against a categorical field is a compile-time validation error, surfaced as a diagnostic rather than a silent no-op.
Combine predicates with the logical forms and, or, and not:

Scope

By default a highlight matches individual observations. The scope option expands each match to a larger visual unit:

Scoping to one layer

In a multi-layer chart (say bars plus a trend line), pass layerIndex to bind the highlight to a single layer. Observations in other layers are never tested, so a Q4 highlight on the bars leaves the trend line untouched:
Omit layerIndex to evaluate the predicate against every layer.

Combining highlights

Multiple highlight() calls accumulate, and the engine unions their matches — an observation matched by any highlight is emphasised. So two separate highlights behave like an or:
Because the union is exactly an or, this is equivalent to a single highlight with an or predicate — same matched observations, same result:
Reach for the single or predicate when the two conditions are one idea; reach for two separate highlights when they’re independent emphases you might toggle separately.

Styling the de-emphasis

How the un-matched observations recede is a rendering concern, set once through config.appearance.highlightStyle:
'dim' (the default) lowers the opacity of non-matched observations; 'desaturate' drains their color toward grey.