Implements interactive selecting starting with mousedown events. Register this behavior on panels that should be selectable by the user, such for brushing and linking. This behavior can be used in tandom with pv.Behavior.drag to allow the selected region to be dragged interactively.
After the initial mousedown event is triggered, this behavior listens for mousemove and mouseup events on the window. This allows selecting to continue even if the mouse temporarily leaves the assigned panel, or even the root panel.
This behavior requires that the data associated with the mark being dragged have x, y, dx and dy attributes that correspond to the mark's location and dimensions in pixels. The mark's positional properties are not set directly by this behavior; instead, the positional properties should be defined as:
.left(function(d) d.x) .top(function(d) d.y) .width(function(d) d.dx) .height(function(d) d.dy)Thus, the behavior does not resize the mark directly, but instead updates the selection by updating the assigned panel's underlying data. Note that if the positional properties are defined with bottom and right (rather than top and left), the drag behavior will be inverted, which will confuse users!
The select behavior is bounded by the assigned panel; the positional attributes are clamped such that the selection does not extend outside the panel's bounds.
The panel being selected is automatically re-rendered for each mouse event as part of the drag operation. This behavior may be enhanced in the future to allow more flexible configuration of select behavior. In some cases, such as with parallel coordinates, making a selection may cause related marks to change, in which case additional marks may also need to be rendered. This can be accomplished by listening for the select psuedo-events:
- selectstart (on mousedown)
- select (on mousemove)
- selectend (on mouseup)
.event("mousedown", pv.Behavior.drag()) .event("select", function() this.parent)This behavior may be enhanced in the future to allow more flexible configuration of the selection behavior.
Defined in: Select.js.
|Constructor Attributes||Constructor Name and Description|
Returns a new select behavior to be registered on mousedown events.