Purpose
Based on the source implementation in~/workspace/source/src/component/brush/BrushModel.ts, the brush component:
- Allows interactive selection of data regions
- Supports multiple brush types: rectangle, polygon, line
- Provides visual feedback for selected and unselected data
- Enables linked brushing across multiple charts
- Supports single or multiple selection areas
- Can be used with toolbox for brush mode activation
Basic Usage
Rectangle Brush
Multiple Selection Mode
Visual Encoding for Selection
Linked Brushing
Configuration Options
From~/workspace/source/src/component/brush/BrushModel.ts:
Brush Type and Mode
Type of brush shape:
'rect': Rectangle selection'polygon': Polygon selection (click to add points, double-click to complete)'lineX': Horizontal line selection'lineY': Vertical line selection
BrushModel.ts:138.Selection mode:
'single': Only one brush area allowed'multiple': Multiple brush areas can coexist
BrushModel.ts:139.Whether brush areas can be transformed (moved, resized) after creation.From
BrushModel.ts:140.Whether to remove brush area on click when it’s already selected.From
BrushModel.ts:148.Target Configuration
Indices of series to apply brush to:
'all': Apply to all series'none'/null/undefined: No series- Number or array: Specific series indices
BrushModel.ts:137.X-axis indices for coordinate-based brushing.
Y-axis indices for coordinate-based brushing.
Geo component indices for geographic brushing.
Brush Styling
Style configuration for brush selection areas. From
BrushModel.ts:141-145:Width of brush area border.
Fill color of brush selection area. From
BrushModel.ts:143.Border color of brush selection area. From
BrushModel.ts:144.Visual Encoding
Visual properties for data items inside brush selection.Default includes
liftZ: 5 to elevate selected items. From BrushModel.ts:183-191:Visual properties for data items outside brush selection.Default color from
BrushModel.ts:150 and initialization at BrushModel.ts:185:Throttling
Throttle type for brush events:
'fixRate': Fixed rate throttling'debounce': Debounced updates
BrushModel.ts:146.Throttle delay in milliseconds. 0 means every event is triggered.From
BrushModel.ts:147.Linked Brushing
Series indices to link together for coordinated brushing:
'all': All series are linked'none'/null/undefined: No linking- Array: Specific series indices to link
BrushModel.ts:100.Toolbox Integration
Brush types to show in toolbox:Where:
'rect','polygon','lineX','lineY': Brush type buttons'keep': Keep selection mode'clear': Clear all selections
BrushModel.ts:96.Z-Index
Z-index for brush components. High value ensures brush appears above other elements.From
BrushModel.ts:149.Brush Areas
The brush component maintains an internal array of brush areas (fromBrushModel.ts:156). Each area includes:
brushType: Shape of the selectionrange: Selected range in pixel/data coordinatespanelId: ID of the coordinate system panel- Styling properties inherited from brush options
Methods
The BrushModel provides methods for programmatic control:setAreas(areas)
Set brush selection areas programmatically. FromBrushModel.ts:197-215:
setBrushOption(brushOption)
Set current brush painting options. FromBrushModel.ts:220-223.
Events
Brush component triggers events that can be listened to:Advanced Example: Multi-Chart Linked Brushing
Use Cases
- Data Exploration: Select and highlight specific data ranges for detailed analysis
- Outlier Detection: Identify and select outlier data points
- Cross-Filtering: Link multiple charts to filter data across visualizations
- Region Selection: Select geographic regions on map charts
- Time Range Selection: Select time periods on time-series charts