admin管理员组文章数量:1287622
Is there a way to make a vertical line in the js graph library dygraph?
I am loading data and would like to put vertical lines like graphite does to show events
is there some special context to add vertical lines
Is there a way to make a vertical line in the js graph library dygraph?
I am loading data and would like to put vertical lines like graphite does to show events
is there some special context to add vertical lines
Share Improve this question asked Sep 8, 2011 at 19:41 BobBob 6711 gold badge7 silver badges12 bronze badges3 Answers
Reset to default 8You've probably figured this out by now, or stopped caring, but the way to do this is with a custom underlay (see http://dygraphs./tests/highlighted-region.html and http://dygraphs./tests/underlay-callback.html for examples). You provide an underlayCallback
function when creating the graph, and it gets called with the canvas element, area
(which helps with coordinate math), and a reference to the Dygraph object.
Here is a simple solution.
Use the crosshair demo (http://dygraphs./tests/crosshair.html) on the Dygraph site.
Once you disable the horizontal bar on the crosshair sample, you are getting a vertical bar.
g4.updateOptions({ pointClickCallback: function(event, p) {
var div_vertical_style="top:0px;left:"+g4.toDomCoords(p.xval,-20)[0]+"px;width:1px;height:"+g4.plotter_.area.h+";background-color:black;position:absolute;";
$("#graphdiv4").append("<div style="+div_vertical_style+"></div>")
}});
//my idea , add div .....
本文标签: javascriptdygraph vertical lineStack Overflow
版权声明:本文标题:javascript - dygraph vertical line - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741317045a2371976.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论