-
-
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
Add scattermapbox select/lasso drag modes #1836
Conversation
- `npm run test-image -- mapbox_*` sometimes blows up
- to easily combine logic for scatter* trace types that use scatter/subtypes.js
- e.g. to allow mapbox subplot convert px coords to lon/lat w/o hackely mocking too many things
- create dragElement on mapbox subplot <div> when dragmode is set to select or lasso, - undo dragElement onmousedown handle for other dragmode values - keep ref to scattermapbox/plot instance in calcdata to call its update method directly in select - must keep track of trace with dimmed pts to go through arrayOk logic in scatter/convert
- ... as it should have been all along, non-attribute keys in fullTrace (and fullLayout for that matter) should be named with a leading underscore. - scattergl glTrace ref is now consistent with the scattermapbox version
- and set dragmode to 'pan' in fullLayout when its value is coerced to 'zoom' so the corresponding modebar button is correctly highlighted. - do this until dragmode 'zoom' (i.e. a zoombox like behavior) is implemented.
- during supplyDefaults
might as well ping @jackparmer @chriddyp @cpsievert who probably can't wait to use this feature. |
When will this make it into pip? Is it already? Really excited for this feature! |
dataPts[ax._id] = pts.filtered.map(axValue(ax)); | ||
} | ||
} | ||
fillRangeItems(eventData, poly, pts); |
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.
Oh, probably we have to merge this before I continue multiselect, because I depend on this part of code a lot.
@etpinard should we consider enabling multiple selection for this too? Related PR |
Not in this PR. This PR here has to go in the next release. Multiple selections is a lower priority item at the moment. Apologies in advance for the merge conflicts. |
@alexcjohnson would you mind taking a 👓 at this? |
src/traces/scattermapbox/convert.js
Outdated
@@ -20,7 +22,8 @@ var convertTextOpts = require('../../plots/mapbox/convert_text_opts'); | |||
|
|||
var COLOR_PROP = 'circle-color'; | |||
var SIZE_PROP = 'circle-radius'; | |||
|
|||
var OPACITY_PROP = 'circle-opacity'; | |||
var DESELECTDIM = 0.2; |
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.
Can you pull this out of here, scatter, and scattergl into a shared constant?
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.
Ha. You caught me being lazy. #1847 will make this thing configurable, but yeah might as well move it to a constant file for now.
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.
done in 882e8e3
Very nice - you can address |
@Holisticnature - This is getting into |
That is great! Thanks for the update! |
@chriddyp - I have it working on my install, but I was hoping there might be some codes samples on added to the Scattermapbox docs on how to update a chart based on the selection. Are there any examples on how to apply the selected items to update a chart? I found a few similar examples with hovering/selecting on histograms on the scatter plot page/dash docs/uber example, but it is not exactly the same. |
resolves #1402
In brief, this PR:
arrayOk
support formarker.opacity
inscattermapbox
traces [ 7d3dd35 ]scattergl
'sgl-scatter2d
mode.scattermapbox
traces [294e5f6]dragElement
on the mapbox<div>
plotly_selecting
,plotly_selected
andplotly_deselect
work as on the other supported subplot typesmapbox-gl@0.22.1
doesn't allow arrayOk settings for those, but the latest version does. So this could be easily added when we bumped themapbox-gl
version after the image server rewrite. Note that, non-circle markers and text fields are still included in theplotly_selected
event data even though they're not dimmed.layout.dragmode
(pan, select, lasso, note that dragmode zoom hasn't been implemented yet for mapbox subplots)cc @alexcjohnson @dfcreative