Search code examples
javascriptdygraphs

Disable all interaction except click


I'm trying to generate a chart with Dygraph library without any interaction available (no zoom, no move,...) but still clickable.

I now how to remove all interaction callbacks with something like

interactionModel: {}

or

interactionModel: { 
   <event>: function (event, g, context) {Dygraph.cancelEvent(event);}
}

but prototype is different from the one used for clickcallback which is

clickCallback: function(e, x, points) { <my code> }

How can I do this?


Solution

  • You want to set

    interactionModel: Dygraph.Interaction.nonInteractiveModel_
    

    This should prevent interaction while still allowing click events to pass through to your clickCallback.

    It's not clear why this interaction model is private: it seems useful!