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'm working on a SCATTERPLOT and adding some user interactions.
'plotly_click' is only called when a user clicks a point
'plotly_selected' is also called when a user clicks either a blank area of the plot OR when a user clicks a point (but returns an empty data obj)
I feel like it makes more sense to call 'plotly_click' no matter where you click on the chart, return data if a point is clicked, but return empty data if no points are clicked.
I'm asking for this feature for some interactions on my scatterplot.
For example:
If a user clicks a point, color the point 'red'
easy, since I can use the data.points[0] to find which marker to color
If a user clicks an empty part of the chart, reset the 'selected' points and color it back to original color.
I can use 'if data == undefined' then color all points back to original color', but problem is data == undefined if I click a point, or click an empty place in chart...'plotly_click' is never called here
The text was updated successfully, but these errors were encountered:
@destradafilm thanks for sharing your thoughts with us.
There's definitively room for improvement in our event namespace. That said, we're currently freezing the event behavior as is in v1 so I pasted your comment in the v2 event issue #145 (comment).
To workaround this problem in the meantime, I'd recommend adding a (plain) click handler to the graph div:
vargd=document.getElementById('graph')Plotly.plot(gd,/* */)// plotly.click stuff triggered within hover distance of ptsgd.on('plotly_click',()=>{})// plain click triggered on any click on graph divgd.addEventListeners('click',()=>{})
I'm working on a SCATTERPLOT and adding some user interactions.
'plotly_click' is only called when a user clicks a point
'plotly_selected' is also called when a user clicks either a blank area of the plot OR when a user clicks a point (but returns an empty data obj)
I feel like it makes more sense to call 'plotly_click' no matter where you click on the chart, return data if a point is clicked, but return empty data if no points are clicked.
I'm asking for this feature for some interactions on my scatterplot.
For example:
If a user clicks a point, color the point 'red'
If a user clicks an empty part of the chart, reset the 'selected' points and color it back to original color.
The text was updated successfully, but these errors were encountered: