Black Lives Matter. Please consider donating to Black Girls Code today.

Get the d2p of a datapoint without a hover event on it

I have a 2 sub-plot scatter chart. I have disabled plotly’s tooltips and show custom tooltip onnplotly_hover function. Now when I hover over a datapoint on one of the sub-plots, i need to show tooltip on this datapoint as well as the corresponding datapoint on the other sub-plot.

Is there any way of getting the d2p of the other subplot’s datapoint without hovering over it?

Thanks

You can try digging into our internal “full” layout object.

var gd = document.getElementById(/* id of your graph div */)

// and then use:
gd._fullLayout.xaxis.d2p
gd._fullLayout.yaxis.d2p