#1789·visx

Brush onBrushEnd does not seem to report the end x position

Author: holgergpCreated Jan 18, 2024Updated Jul 19, 2025

Hello visx folks!

I am currently introducing a brush to a bar char. While working quite nicely, I noticed that the onBrushEnd callback - that reports a bound - does not report the target x value correctly. I made a sandbox for this: https://codesandbox.io/p/sandbox/relaxed-star-q6jjzg?file=%2Fsrc%2FApp.js There I introduced a Brush which is console logging the bound onBrushEnd. The Brush is using a scaleBand on the x-axis and a scaleLinear on the y-axis. The bound which is reported has the following structure: { "x0": 0, "x1": 0, "xValues": [ "Item 1", "Item 2" ], "y0": -31.428571428571406, "y1": 402.85714285714283 }

While y0 and y1 seem reasonable, x0 might be correct, x1 being 0 is not what I am expecting, as the rectangle has width > 0.

Am I using the brush wrong? Looks like a bug to me. How would the idea be, to get the coordinates of the brushed rectangle?

Thanks for your awesome work!

Cheers from Düsseldorf!

Holger