javascript – jquery.flot.dashes.js是否支持plothover和plotclick?
作者:互联网
我有一个可行的工具提示系统设置与我的常规图形选项(不使用破折号)通过使用plothover事件,但当我切换到我的“黑白”模式(使用破折号)时,情节是不可能的.有没有办法在使用破折号时保持图形可以浏览和可点击?还是一种在没有破折号的情况下制作体面的黑白图案的方法?
示例系列:{data:data,dashes:{show:true,dashLength:2},color:“black”,label:“Series 1”}
我目前的图形选项:
options = {
yaxis: {max: maxValue, min: minValue},
grid: {hoverable: true, clickable: true},
legend: {show: false},
xaxis: {tickFormatter: null}
};
我将plothover事件用于这样的工具提示:
$(this).bind(“plotclick”,function(event,pos,item){
//这里的工具提示代码
}
解决方法:
请参阅jQuery.flot.dashes插件中的this issue填充.
Regarding the hover issue, there’s a function called “findNearbyItem”
in jquery.flot.js that performs the search only if the plot is showing
lines, points or bars. If you only have “dashes” showing, then it
won’t perform the search.Two choices:
– Modify the jquery.flot.js file in the following line:if (s.lines.show || s.points.show)
to something like
if (s.lines.show || s.points.show || s.dashes.show)
– Show points with 0 radius in the series you show dashes: (from the example in comment #41)
{ label: "sin(x)", data: d1, dashes: { show: true, steps:true }, points: {show: true, radius:0 }}
我同意海报,第二个解决方案是一个更好的主意.我也试过了in this fiddle and is works well.
标签:javascript,jquery,flot,hover 来源: https://codeday.me/bug/20190830/1769816.html