use*_*633 4 javascript jquery flot hover
我有一个可行的工具提示系统设置与我的常规图形选项(不使用破折号)通过使用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}
};
Run Code Online (Sandbox Code Playgroud)
我将plothover事件用于这样的工具提示:
$(this).bind("plotclick", function (event, pos, item){
//tooltip code here
}


请参阅针对该插件填写的此问题jQuery.flot.dashes.
关于悬停问题,jquery.flot.js中有一个名为"findNearbyItem"的函数,只有当图表显示线条,点或条形时才执行搜索.如果您只显示"破折号",则它不会执行搜索.
有两种选择:
- 修改以下行中的jquery.flot.js文件:if (s.lines.show || s.points.show)类似于if (s.lines.show || s.points.show || s.dashes.show)
- 在显示破折号的系列中显示半径为0的点:(来自注释#41中的示例)
{ label: "sin(x)", data: d1, dashes: { show: true, steps:true }, points: {show: true, radius:0 }}
我同意海报,第二个解决方案是一个更好的主意.我也试过这个小提琴并且效果很好.
| 归档时间: |
|
| 查看次数: |
1496 次 |
| 最近记录: |