altair.selection_point#
- altair.selection_point(name=None, value=Undefined, bind=Undefined, empty=Undefined, expr=Undefined, encodings=Undefined, fields=Undefined, on=Undefined, clear=Undefined, resolve=Undefined, toggle=Undefined, nearest=Undefined, **kwds)#
Create a point selection parameter. Selection parameters define data queries that are driven by direct manipulation from user input (e.g., mouse clicks or drags). Point selection parameters are used to select multiple discrete data values; the first value is selected on click and additional values toggled on shift-click. To select a continuous range of data values on drag interval selection parameters (selection_interval) can be used instead.
- Parameters:
- namestr (optional)
The name of the parameter. If not specified, a unique name will be created.
- valueAny (optional)
The default value of the parameter. If not specified, the parameter will be created without a default value.
- bind
Binding
, str (optional) Binds the parameter to an external input element such as a slider, selection list or radio button group.
- emptybool (optional)
For selection parameters, the predicate of empty selections returns True by default. Override this behavior, by setting this property ‘empty=False’.
- expr
Expr
(optional) An expression for the value of the parameter. This expression may include other parameters, in which case the parameter will automatically update in response to upstream parameter changes.
- encodingsSequence[str] (optional)
A list of encoding channels. The corresponding data field values must match for a data tuple to fall within the selection.
- fieldsSequence[str] (optional)
A list of field names whose values must match for a data tuple to fall within the selection.
- onstr (optional)
A Vega event stream (object or selector) that triggers the selection. For interval selections, the event stream must specify a start and end.
- clearstr, bool (optional)
Clears the selection, emptying it of all values. This property can be an Event Stream or False to disable clear. Default is ‘dblclick’.
- resolveLiteral[‘global’, ‘union’, ‘intersect’] (optional)
With layered and multi-view displays, a strategy that determines how selections’ data queries are resolved when applied in a filter transform, conditional encoding rule, or scale domain. One of:
‘global’: only one brush exists for the entire SPLOM. When the user begins to drag, any previous brushes are cleared, and a new one is constructed.
‘union’: each cell contains its own brush, and points are highlighted if they lie within any of these individual brushes.
‘intersect’: each cell contains its own brush, and points are highlighted only if they fall within all of these individual brushes.
The default is ‘global’.
- togglestr, bool (optional)
Controls whether data values should be toggled (inserted or removed from a point selection) or only ever inserted into point selections. One of:
True (default): the toggle behavior, which corresponds to “event.shiftKey”. As a result, data values are toggled when the user interacts with the shift-key pressed.
False: disables toggling behaviour; the selection will only ever contain a single data value corresponding to the most recent interaction.
A Vega expression which is re-evaluated as the user interacts. If the expression evaluates to True, the data value is toggled into or out of the point selection. If the expression evaluates to False, the point selection is first cleared, and the data value is then inserted. For example, setting the value to the Vega expression True will toggle data values without the user pressing the shift-key.
- nearestbool (optional)
When true, an invisible voronoi diagram is computed to accelerate discrete selection. The data value nearest the mouse cursor is added to the selection. The default is False, which means that data values must be interacted with directly (e.g., clicked on) to be added to the selection.
- **kwdsAny
Additional keywords to control the selection.
- Returns:
- parameter: Parameter
The parameter object that can be used in chart creation.