2

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?

Please, help me, I am all at sea.

JDnepr
  • 23
  • 4
  • Because your hover event is triggered on the whole plot, you need to bind the hover event on the node ( x, y or z axis ). Look deeper into docs, try to find the right node. – The Bumpaster Aug 06 '18 at 04:38
  • 1
    I know it's long time ago, but did you find a solution, I have exactly the same problem? – Turvy Nov 19 '19 at 14:25

0 Answers0