Skip to content
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

Lasso & rectangular selections #154

Merged
merged 35 commits into from
Jan 6, 2016
Merged

Lasso & rectangular selections #154

merged 35 commits into from
Jan 6, 2016

Conversation

alexcjohnson
Copy link
Collaborator

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:
crazy lasso

We need icons for rectangle and lasso selection.

cc @etpinard @jackparmer

@alexcjohnson
Copy link
Collaborator Author

@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?

@jackparmer
Copy link
Contributor

Yeeeeeeehaw! This looks slick!
@delekru can you look into some modebar icon options?

pan: 'move',
zoom: 'crosshair',
select: 'crosshair',
lasso: 'crosshair' // TODO: better cursors for select and lasso?
Copy link
Collaborator Author

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.

Copy link
Contributor

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.

@alexcjohnson
Copy link
Collaborator Author

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
Copy link
Collaborator Author

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.

@delekru
Copy link

delekru commented Dec 31, 2015

@jackparmer @alexcjohnson

There's a few options for a 'box select' icon:
screen shot 2015-12-31 at 10 50 42 am
screen shot 2015-12-31 at 10 57 00 am
Both of those were from Fontastic. I prefer the first one.

The lasso select icon is pretty rare. I've browsed all the icons inside Fontastic and there's nothing really that resembles a lasso or dotted circle. The closest things are:
screen shot 2015-12-31 at 11 16 13 am
screen shot 2015-12-31 at 11 16 48 am
screen shot 2015-12-31 at 11 17 58 am
A combination of those three would be perfect, but neither one of them seems intuitive/appropriate enough.

Is there any other icon database you guys use?

@jackparmer
Copy link
Contributor

The one Bokeh uses is pretty decent:
image
http://bokeh.pydata.org/en/0.10.0/docs/user_guide/tools.html#lassoselecttool
Might be a good placeholder if everyone else finds it OK.
Otherwise I usually just Google for icons until I find one I like.

rectFirstEdgeTest;

function onFirstVert(pt) { return pt[0] === pts[0][0]; }
function onFirstHorz(pt) { return pt[1] === pts[0][1]; }
Copy link
Contributor

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@alexcjohnson
Copy link
Collaborator Author

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

@etpinard @chriddyp anything else?

@delekru
Copy link

delekru commented Jan 6, 2016

@alexcjohnson

Alright sounds good. I'll ask for some help on that.

@delekru
Copy link

delekru commented Jan 6, 2016

@alexcjohnson @etpinard @jackparmer

Alright so, for box select, do we all agree to use this icon?

screen shot 2015-12-31 at 10 50 42 am

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:

lasso

All good?

@etpinard
Copy link
Contributor

etpinard commented Jan 6, 2016

@delekru +1 and +1 for me.

DBLCLICKDELAY: 600,

// pixels to move mouse before you stop clamping to starting point
MINDRAG: 8,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor point:

I'd vote for making MINDRAG for select box bigger. I find it kind of hard 1d-selecting over large ranges.

Maybe @chriddyp, @cldougl @mdtusz could try it out.

Copy link
Contributor

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.

Copy link
Member

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

Copy link
Collaborator Author

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.

@alexcjohnson
Copy link
Collaborator Author

@delekru those icons look great!

@etpinard
Copy link
Contributor

etpinard commented Jan 6, 2016

@alexcjohnson awesome.

💃 for once we get the icons in.

@alexander-daniel @delekru let's do this.

@etpinard
Copy link
Contributor

etpinard commented Jan 6, 2016

@alexcjohnson @chriddyp @cpsievert @mdtusz @cldougl @jackparmer

Last chance for a review ...

@cldougl
Copy link
Member

cldougl commented Jan 6, 2016

👍 from me!

@ncammarata
Copy link

ncammarata commented May 23, 2016

@chriddyp any update on crossfilter style 1d selections?

If not, any idea how I can implement in the meantime?

@chriddyp
Copy link
Member

hey @ncammarata !
If you're working in R, you can do this in Shiny and Plotly: https://plot.ly/r/shinyapp-linked-brush/
Here is an example if you're working in JS: https://plot.ly/javascript/lasso-selection/

@ncammarata
Copy link

ncammarata commented May 24, 2016

@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?

@gszep
Copy link

gszep commented Jul 25, 2022

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 :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants