altair.PointSelectionConfig#
- class altair.PointSelectionConfig(type=Undefined, clear=Undefined, encodings=Undefined, fields=Undefined, nearest=Undefined, on=Undefined, resolve=Undefined, toggle=Undefined, **kwds)#
PointSelectionConfig schema 包装器。
- 参数:
- typeLiteral[‘point’]
确定选择的默认事件处理和数据查询方式。Vega-Lite 当前支持两种选择类型:
"point"
– 用于选择多个离散数据值;第一个值通过click
选择,后续值通过 Shift+click 切换。"interval"
– 用于通过drag
选择连续的数据值范围。
- clearstr, bool, dict,
Stream
,EventStream
,MergedStream
,DerivedStream
清除选择,使其为空。此属性可以是事件流(Event Stream)或
false
以禁用清除。默认值:
dblclick
。另请参阅: 文档中的清除示例。
- encodingsSequence[
SingleDefUnitChannel
, Literal[‘x’, ‘y’, ‘xOffset’, ‘yOffset’, ‘x2’, ‘y2’, ‘longitude’, ‘latitude’, ‘longitude2’, ‘latitude2’, ‘theta’, ‘theta2’, ‘radius’, ‘radius2’, ‘color’, ‘fill’, ‘stroke’, ‘opacity’, ‘fillOpacity’, ‘strokeOpacity’, ‘strokeWidth’, ‘strokeDash’, ‘size’, ‘angle’, ‘shape’, ‘key’, ‘text’, ‘href’, ‘url’, ‘description’]] 一个编码通道数组。对应的数据字段值必须匹配,数据元组才能落入选择范围内。
另请参阅: 文档中的使用编码和字段的投影(projection)部分。
- fieldsSequence[str,
FieldName
] 一个字段名称数组,其值必须匹配,数据元组才能落入选择范围内。
另请参阅: 文档中的使用编码和字段的投影(projection)部分。
- nearestbool
当为 true 时,计算一个不可见的 Voronoi 图,以加速离散选择。鼠标光标最近的数据值将被添加到选择中。
默认值:
false
,这意味着数据值必须直接交互(例如点击)才能添加到选择中。另请参阅: nearest 示例文档。
- onstr, dict,
Stream
,EventStream
,MergedStream
,DerivedStream
一个Vega 事件流(对象或选择器),用于触发选择。对于区间选择,事件流必须指定一个起点和终点。
另请参阅: 文档中的on 示例。
- resolve
SelectionResolution
, Literal[‘global’, ‘union’, ‘intersect’] 对于分层和多视图显示,此策略确定当选择应用于过滤器转换、条件编码规则或比例尺域时,如何解析选择的数据查询。
以下之一:
"global"
– 整个 SPLOM 中只存在一个画刷。当用户开始拖动时,任何先前的画刷将被清除,并构建一个新的画刷。"union"
– 每个单元格包含自己的画刷,如果点位于这些独立画刷中的任何一个内,则会被突出显示。"intersect"
– 每个单元格包含自己的画刷,只有当点位于所有这些独立画刷内时,才会被突出显示。
默认值:
global
。另请参阅: 文档中的resolve 示例。
- togglestr, bool
控制数据值是否应该被切换(插入或从点选择中移除)或仅插入到点选择中。
以下之一:
true
– 默认行为,对应于"event.shiftKey"
。因此,当用户按住 Shift 键进行交互时,数据值会被切换。false
– 禁用切换行为;选择将始终只包含与最近一次交互对应的单个数据值。一个Vega 表达式,当用户交互时会重新评估。如果表达式评估为
true
,数据值将被切换进或切换出点选择。如果表达式评估为false
,则首先清除点选择,然后插入数据值。例如,将值设置为 Vega 表达式"true"
将在用户不按 Shift 键的情况下切换数据值。
默认值:
true
另请参阅: 文档中的toggle 示例。
- __init__(type=Undefined, clear=Undefined, encodings=Undefined, fields=Undefined, nearest=Undefined, on=Undefined, resolve=Undefined, toggle=Undefined, **kwds)#
方法
__init__
([type, clear, encodings, fields, ...])copy
([deep, ignore])返回对象的副本。
from_dict
(dct[, validate])从字典表示构造类。
from_json
(json_string[, validate])从有效的 JSON 字符串实例化对象。
resolve_references
([schema])在此对象的 schema 或根 schema 的上下文中解析引用。
to_dict
([validate, ignore, context])返回对象的字典表示。
to_json
([validate, indent, sort_keys, ...])将此对象的 JSON 表示作为字符串发出。
validate
(instance[, schema])在 rootschema 的上下文中根据类 schema 验证实例。
validate_property
(name, value[, schema])在 rootschema 的上下文中根据属性 schema 验证属性。