You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
holgergp
changed the title
Brush onBrush does not seem to report the end x position
Brush onBrushEnd does not seem to report the end x position
Jan 18, 2024
As I see it, the scaleInvert function wraps cases like this but seems to be the code is focused on ordinalScale only.
see utils.tsx (getDomainFromExtent(), scaleInvert())
May it have the bug?
PS. at the moment I am unable to debug that...sorry
PS. The idea by holgergp to extend the bounds with extra info looks great for me.
If I remember, the d3-brush events contain target object etc as well.
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 abound
- 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 ascaleBand
on the x-axis and ascaleLinear
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
andy1
seem reasonable,x0
might be correct,x1
being0
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
The text was updated successfully, but these errors were encountered: