I don’t actually have a working code snippet to share but here’s what I’m trying to do.
I’ve created a graph using
Plotly.newPlot(theGraph, [graphData], layout, graphSettings); where the graphSettings object has removed the
'hoverCompareCartesian' button from the ModeBar. However this actual hover setting is still being applied. It’s the default.
So what I want to do here is make the default hover setting
'hoverClosestCartesian' and have that button pre-selected (and un-toggle-able, which it already is)
There’s no ModeBar ‘object’ once the JS has all compiled though, it’s included in the build somewhere (or at least I can’t seem to debug to a point where I can find it!) There’s no
Plotly.ModeBar(theGraph) or simply
theGraph.ModeBar or any combination of these that I can find. The index.js file makes me think this is simply used in the initialisation of the Plotly object and has no public API.
I thought a workaround would be simply wait for the graph to load, find the button in the DOM and trigger a click on it. However a scripted click on the button does nothing to it’s state. It’s as if you’ve not clicked it. Clicking with the mouse does work.
As it stands I’ve reinstated the compare button to the graph for the time-being.