-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Lasso & rectangular selections #154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@etpinard I mostly don't have internet here in Albania... and the Jasmine tests fail without it because they want to load topo data from the cdn. Is that necessary? |
Yeeeeeeehaw! This looks slick! |
pan: 'move', | ||
zoom: 'crosshair', | ||
select: 'crosshair', | ||
lasso: 'crosshair' // TODO: better cursors for select and lasso? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Crosshair is a pretty good cursor for what you're doing, it just doesn't disambiguate these from each other or from zoom. Maybe that's OK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 'crosshair'
for select and lasso.
not sure what's going on with the image tests... going to have to wait and look at that tonight. |
title: 'Lasso Select', | ||
attr: 'dragmode', | ||
val: 'lasso', | ||
icon: Icons.question, // TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@delekru here (and right above) are where the new icons get referenced, once they're part of the ploticon font.
The one Bokeh uses is pretty decent: |
rectFirstEdgeTest; | ||
|
||
function onFirstVert(pt) { return pt[0] === pts[0][0]; } | ||
function onFirstHorz(pt) { return pt[1] === pts[0][1]; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe inline these for readability sake. They appear to only be used once each.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
OK, I think this is good from my side - all yours @delekru for the icons. If you need help getting them into the ploticon font check with @alexander-daniel |
Alright sounds good. I'll ask for some help on that. |
@alexcjohnson @etpinard @jackparmer Alright so, for box select, do we all agree to use this icon? As for the lasso icon, there was some issue with buying the icons and royalty fees with the ones that were posted on this thread so instead I just drew one myself. Here's a picture: All good? |
@delekru +1 and +1 for me. |
DBLCLICKDELAY: 600, | ||
|
||
// pixels to move mouse before you stop clamping to starting point | ||
MINDRAG: 8, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be a bit more code, but making the MINDRAG
a function of the main drag distance would be useful I think. Something with a log scale would be useful. If I 1D drag the width of my screen, it's likely going to fluctuate a whole lot more than if I drag 100px.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for a larger MINDRAG
from me too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I've made a MINSELECT that's a little bigger than MINDRAG (12 instead of 8). b5c090f
I don't want to make it as big as MINZOOM (or make it an increasing function of distance) because this limits how thin a rectangle you can select. Which is not a problem with MINZOOM because you can always zoom a second time.
@delekru those icons look great! |
@alexcjohnson awesome. 💃 for once we get the icons in. @alexander-daniel @delekru let's do this. |
@alexcjohnson @chriddyp @cpsievert @mdtusz @cldougl @jackparmer Last chance for a review ... |
👍 from me! |
Lasso & rectangular selections
@chriddyp any update on crossfilter style 1d selections? If not, any idea how I can implement in the meantime? |
hey @ncammarata ! |
@chriddyp that handles the 2d plot (which I'm using now with lasso), but does it handle the 1d time series use-case that crossfilter handles? |
do I understand correctly that these selection tools break when cross-filtering with more than 1000 points? I'm using the generic cross-filtering example in the docs and when I set the number of points to be higher the update takes ages :( |
At the moment this just supports scatter traces with markers, should be extensible to other types. scatter lines would be cool but I don't see how to do it. scatter text would be an easy addition.
I haven't done any rigorous performance testing (will be interesting to see how many points this can handle) but I was able to draw a pretty crazy lasso and I didn't detect any lag:

We need icons for rectangle and lasso selection.
cc @etpinard @jackparmer