Project a Selection
Edit this pageA selection’s type determines which data values fall within it by default:
- For
single
andmulti
selections, only values that have been directly interacted with (i.e., those that have been clicked on) are considered to be “selected.” - For
interval
selections, values that fall within both the horizontal (x
) and vertical (y
) extents are considered to be “selected.”
These default inclusion criteria can be modified with the project selection transformation, which offers the following two properties:
Property | Type | Description |
---|---|---|
encodings | String[] |
An array of encoding channels. The corresponding data field values must match for a data tuple to fall within the selection. See also: |
fields | FieldName[] |
An array of field names whose values must match for a data tuple to fall within the selection. See also: |
Examples
In the scatterplot example below, use the project transformation to highlight : .
With interval selections, the project transformation can be used to restrict the region to just the and/or dimensions.
Current Limitations
- Selections projected over aggregated
fields
/encodings
can only be used within the same view they are defined in. - Interval selections can only be projected using
encodings
. - Interval selections projected over binned or
timeUnit
fields remain continuous selections. Thus, if the visual encoding discretizes them, conditional encodings will no longer work. Instead, use a layered view as shown in the example below. The bar mark discretizes the binnedAcceleration
field. As a result, to highlight selected bars, we use a second layered view rather than a conditional color encoding within the same view.