Change configuration(specifically scrollzoom) without replotting?

Let me describe my use case before i ask my question: i have a page with many charts on it. I want my users to be able to use the mouse wheel to scroll and that is no problem. i just set scrollzoom: true. However, this leads to each plot ā€˜catchingā€™ the mouse wheel event when the user is scrolling through the document itself. Iā€™d like to have it so that the plot only catches the zoom events if the user has indicated that they interacting with the given plot. I can hook this up without issue using click events. The problem comes in how do i update scroll zoom when the user is done interacting with the document via clicking somewhere else in the document (indicating that i should set scrollzoom: false on that plot). If I do Plotly.newPlot to update the config, it indeed does set the scrollzoom correcty but it also resets the zoom to default when I want it to retain the zoom which the user had manually set it to.

None of the other exported plotly functions which I see allow me to set configuration without replotting. So my question is, is that right or is there some way to do this which Iā€™m missing? Is there some other pattern to follow here?

I can work around this by detecting the zoom, doing newplot and then explicitly setting the zoom back to what it was but that is pretty lame.

Any protips would be most appreciated.
MFed

I think replacing your newPlot calls with plain plot calls should do the trick: http://codepen.io/etpinard/pen/qNZGxR

More general, youā€™re making two great points:

  • scrolling should really be a layout attribute, on-par layout.dragmode and layout.hovermode You may want to add to the discussion in https://github.com/plotly/plotly.js/issues/143
  • We should add an after-click scroll mode to handle situations like you described natively - which I believe are fairly common.

@etienne Thanks for the codepen. I had tried ā€˜plotā€™ instead of ā€˜newplotā€™ but my issue was that i continued to feed it data and layout. Plot with just the scrollzoom does what i was looking for thanks.

@etienne Where can one find docs for the top-level plotly.js APIs like this? When I search for newPlot nothing comes up, and when I try plot a zillion things that arenā€™t what Iā€™m looking for appear.

Update: Nevermind, I think I figured it out. For some reason it is not part of the ā€œFull referenceā€ :angry:. Itā€™s in Functional Reference