Updating chart title according to zoom/pan

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-08 10:47:23

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/32764367/updating-chart-title-according-to-zoom-pan

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!