-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Persistent and Multiple Clicking and Unclicking Behaviour #1852
Comments
A few requests for this from the Dash community (https://community.plot.ly/t/highlight-clicked-marker-in-scattermapbox-graph/8315, https://community.plot.ly/t/is-there-a-way-to-clear-clickdata/8708). If you are using Dash in your company or organization and can fund the development of this feature, please reach out. |
A few notes after discussing this offline with @chriddyp
|
yeah that would be really nice.
agreed.
I like a top-level
I guess we could make
Agreed.
👍 for shift clicks!
I guess this should be configurable in a similar way to |
I like that - so users who already implemented hacks to get a similar result (@cpsievert) or switching between select and some other click behavior could set
Yeah possibly - for immediate cross-plot brushing like https://rd3.now.sh/ perhaps. Doesn't seem to me like the two conflict though, we could add that later and people might even want to use the two together, so you can persistently select some points then add the transient hover selection to it.
Alternatively, don't implement a second attribute, have selection and event data always match hover data, but make I started describing how a second `click* attribute would look and it got really complicated (below), so ^^ is my vote, I think it's both clearer for users (it's obvious what exactly you're clicking on) and easier to implement!
|
I had a feeling adding a second click attribute would made things confusion. Thanks for confirming that feeling I had. Much of the spikes behavior is tied down to Maybe the problem with
Oof, that might be a little too magical here for my taste. How bad (for most applications) would |
Per #420 (comment) we're thinking of changing the default |
Now that #420 (comment) is been added to our v2 checklist, 👍 for making |
This is just the documentation of a team internal discussion. It was about the questions if users should be able to deselect a data point that has already been selected by a box or lasso select. TL;DR is to make sure that if a user deselects a data point in an existing lasso or box area, this point should stay deselected even if another box or lasso selection take place. Here's a screen recording of the current misbehavior in current development state. Watch out for what happens when the last lasso select takes place. Other options would have been
|
@alexcjohnson @etpinard I'd like to show the solution I came up with to cover the edge cases regarding the interplay of box-lasso-select and click-select and ask for your feedback before moving on. (I published the current changes in my own fork, see below) Current box-lasso-select approach Edge case interplay box-lasso-select vs. click-select Approaches
Rationale for approach 3
The logic of whether a point is going to be selected or not has definitely moved from the trace modules towards the calling code in Please see the current changes in https://github.com/rmoestl/plotly.js/commits/1852-persistent-click. For your convenience I temporarily committed my testing mock named |
I actually think that option 2 is nice, especially if coupled with the inverse: click-to-select creates a tiny non-subtract polygon, such that all data at a given location is selected/deselected. |
On the one hand, that'd be a nice feature. On the other hand, a user would not have the ability to select just a single data point. And users can already select all data at one location by drawing a little polygon over the respective area. |
True, but what’s the use case for selecting a single point at a location
with multiple other points when you can’t control which of the collocated
points is selected?
…On Fri, Jun 22, 2018 at 01:27 Robert Möstl ***@***.***> wrote:
On the one hand, that'd be a nice feature. On the other hand, a user would
not have the ability to select just a single data point. And users can
already select all data at one location by drawing a little polygon over
the respective area.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1852 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAMbA_ZY1sUw9rpajj_rWUoKvZ1tM0W5ks5t_IAqgaJpZM4ONn7y>
.
|
I think approach 3, as you've done it, is the right one - there may be other ways to select points that DO differentiate multiple points at the same coordinates, for example on a SPLOM you select points in one pane where they have different coordinates, then you modify that selection in a pane where they overlay. Working only with polygons would not be able to handle this. I can certainly see the appeal of having click-to-select pick all points at the current location instead of just the top one - while you're right that users can already do this with a tiny polygon, there's no way to select just an occluded point either way, so this seems like a limitation as much as a feature. But I think we should solve this as a separate issue in concert with a multi-overlapping-point hovermode, that perhaps makes hover labels like |
Yes, I think as long as we don't have multi-overlapping-point hovermode, it could be confusing for users to be presented with a hover label of one point and find multiple selected after a click. Any feedback on the interface change I described, Alex? |
Totally agreed on breaking up the functionality that way, and toggleSelected(searchInfo, selected, pointIds)
// @param {boolean} selected: are these points to be selected (true) or deselected (false)
// @param {array[integer]} pointIds: the points to modify - omit to modify all points in the trace.
// ie clearSelection is toggleSelection(searchInfo, false) |
Yes, sure we can. |
Referencing #720 the multi-overlapping-point hovermode issue. Splitting the "which pts are in this polygon" logic from "tag these pts as selected" makes a ton of sense, and should improve performance too. So, 👍 from me 🎉 I agree with @alexcjohnson , we should aim for two trace Now, before going any further, @rmoestl you should try your new internal API on a non-array-of-objects-calcdata trace module e.g. |
Okay, I see |
Tricky question... I’m not sure “selectable” is going to serve us well, or at the very least it’s likely to change over time as we figure out meaningful ways to select more kinds of objects. Can we just annotate each item as to what it represents, and have the module decide what to do with it? Re: |
Not sure what you mean by
Let the trace module detect which point has been clicked (similarly to |
Absolutely, hovering on a box should not include
I think what @alexcjohnson means is (1) add below this line |
Mhm, I see. Until now my approach was to let the base plot (i.e. cartesian) figure out the clicked point based on the assumption that hoverdata is relatively homogeneous across traces. The proposed solution suggests to make detecting which point has been clicked a concern of the traces themselves. What about having a hybrid approach: for traces that expose a function with a certain name, e.g. plotly.js/src/components/fx/helpers.js Line 143 in f06032f
|
Apart from boxes and violins, traces with Now,
this would be very nice, unfortunately we're not there yet. But I agree with you: in theory, we should be able to figure out the clicked point based on So, I don't think we should add another method on the module objects (e.g. |
Okay, sounds reasonable to me as well. We're putting in temporary logic in one place and weed out parts of it as soon as |
- Reason: new approach is needed to support proper interplay of polygon and click select. See #1852 for a discussion. - New approach separates the two concerns 'what was selected' and 'set selected state of data points', that were previously handled by `selectPoints`, into multiple functions. - Also the polygons now longer implicitly carry selection state in cartesian/select.js but are only visual cues anymore. - Introduce a new Lib function for calculating the set difference of two arrays.
Is it correct that one needs to hold both plotly.js/test/jasmine/tests/select_test.js Line 262 in 24b2912
Alt key.CC @etpinard |
That's correct. You're right this test looks odd. I think if you just Alt+click the browser doesn't register clicks. Does that test fail if we set |
Nope, test does not fail with |
- Reason: new approach is needed to support proper interplay of polygon and click select. See #1852 for a discussion. - New approach separates the two concerns 'what was selected' and 'set selected state of data points', that were previously handled by `selectPoints`, into multiple functions. - Also the polygons now longer implicitly carry selection state in cartesian/select.js but are only visual cues anymore. - Introduce a new Lib function for calculating the set difference of two arrays.
That sounds fine to me! |
Is box/lasso select supposed to be supported for I was able to fix failing |
Looks like they're broken at the moment. |
... on |
I'll come up with a fix ASAP. |
Closed in #2944 |
Very closely related to Persistent, stateful hover, click, and selection properties and Customized Click, Hover, and Selection Styles or Traces is the ability for users to select one or more points through clicking.
Under the hood, this might just be a new "select" mode (like "Box Select" or "Lasso Select") that allows users to select and de-select points through clicking. Once clicked, the style of the clicked points would remain persistent.
From a UI perspective, the user would be informed that points are clickable and unclickable through:
cursor: pointer
See this tableau dashboard for an example: https://public.tableau.com/profile/joe3537#!/vizhome/WorldBankIndicator/WorldData
Related to Persistent, stateful hover, click, and selection properties, users should be able to programatically specify which points are selected in order to initialize their graphs with pre-selected data.
cc @alexcjohnson @etpinard @monfera @jackparmer @charleyferrari
The text was updated successfully, but these errors were encountered: