Skip to content

Feature request: segment/line-brush selection, select marks that intersect a drawn line #9833

Description

@mattijn

Vega-Lite supports point and interval selections. I'd like to propose another one: a segment brush, where the user drags to define a line segment and any mark (or series) whose geometry crosses that segment becomes selected.

Motivating use case: the Contribution-Value plot (explaining.ml/cvplots), where each instance is a polyline and the user can drag a line in the plot that then will select all polylines which intersect that line, revealing clusters in the feature contribution vectors. This selection is linked to multi data views.

See screen recording of the Vega-lite I have so far:

Screen.Recording.2026-04-15.at.22.16.16.mov

Open the Chart in the Vega Editor (its still a bit buggy when doing the selection quickly, but if you do the interaction a bit slowly it works)

Currently this requires variable params with on handlers which doesn't validate (no error at least), a window lead transform to build segment pairs, and a manual segment-intersection calculate expression, all of which is fragile and bypasses the power of Vega-Lite's abstraction entirely.

Maybe something like this:

{
  "name": "seg_brush",
  "select": {
    "type": "segment",
    "on": "drag"
  }
}

With condition encoding tied to it like any other selection. The intersection test against line marks would be built in.

Relation to lasso selection: if freehand/lasso selection lands (#9723), a straight-line segment is a degenerate case of that, though the intersection semantic (crosses the line) is different from the containment semantic (falls inside the lasso).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions