I am trying to update the dygraph title according to the current visible window. Such information can be retrieved using graph.xAxisRange(), however checking the documentation shows that there is only a callback for zoom.
The zoom callback works fine but won't get called after a pan is made. Also tried to use draw callback with lack of success.
Is there any possible solutions for this?
drawCallback
is what you want. You have to be careful to avoid loops with it, though — calling updateOptions
inside of a drawCallback
can invoke the drawCallback
again. Take a look at synchronizer.js
to see a workaround.
An alternative would be to throttle your calls to updateOptions
within the drawCallback
, e.g. to one update every 500ms.