Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

Scatter3d Plotly.restyle loops plotly_onhover

Hello,

I am implementing a 3d scatterplot using plotly.js and the task I am currently working on - change the color of the dot when you hover (or click - does not matter) on it. I have found the example that works perfectly well for the 2d scatter plot. However, it does not work for a 3d scatter plot. After an “onhover” event, the script starts executing “plotly_onhover” function infinitely many times, till it throws an error.

Here is code which is working with 2d scatter: https://codepen.io/plotly/pen/xgxbrj

And the code which is NOT working with 3d scatter: https://codepen.io/anon/pen/PKewob

The problem is in Plotly.restyle('myDiv', update, [tn]); line. I suppose it is calling “plotly_onhover” function again and again. Why it does not happen in 2d scatter plot then?

Actually, the whole intention of it - is to select points which are hovered (or clicked). It seems that there is no such function for scatter3d implemented.

Please, help me, I am all at sea.

Related report https://github.com/plotly/plotly.js/issues/1025

Is there a solution for this? After a few days of research I found this link, and its more or less the problem I have. Code that worked to change the color of a plotly scatter plot in 2D does a fine job, but in scatter3d nothing happens