Skip to main content
Public

Share visualization

Loading preview…

Brushing Circles with D3-Brush

vizhub.com

Shared links may look like this on X, LinkedIn, Slack, and Discord.

Before sharing, review the publishing checklist.

Choose how to deliver this visualization

LinkedIn caption

LinkedIn may not keep text supplied by the share sheet. Copy the caption and paste it into the post if needed. You can tag the VizHub company page when posting.

More options

Embed on a websiteCopy iframe embed code
Download & exportPNG, HTML, source ZIP

Brushing Circles with D3-Brush

0
CCurran Kelleher
Last edited Feb 29, 2024
Created on Feb 28, 2024
Forked from Circles with D3

This example demonstrates interactive brushing on a scatterplot of six circles, where dragging a rectangular selection highlights overlapping data points. It shows how a brush can filter or emphasize specific marks in a visualization. The implementation uses D3’s `brush` module, with a `brush` event listener that checks each circle’s coordinates against the selection bounds to update a `highlightedSet` in the state. Circle styling (stroke, opacity) responds to the highlighted set, and the `end` event clears highlights when the brush is dismissed. The rendering uses SVG elements via D3’s `select` and `join` pattern.

AI-generated description

A demonstration of how to implement brushing to select circles using d3-brush.

Challenge

  • Apply this technique to one of your visualizations, such as a scatter plot, to highlight certain data points

Comments

Sign in to join the discussion.

MIT Licensed