Does jquery.flot.dashes.js support plothover and plotclick?(jquery.flot.dashes.js 是否支持 plothover 和 plotclick?)
问题描述
通过使用 plothover 事件,我使用正常的图形选项(不使用破折号)设置了一个可行的工具提示系统,但是当我切换到黑白"模式(使用破折号)时,绘图无法悬停.使用破折号时,有什么方法可以使图表保持可悬停和可点击?或者有一种方法可以在没有破折号的情况下以黑白方式制作出体面的情节?
I have a workable tooltip system set-up with my normal graphing options (not using dashes) by using the plothover event, but the plot is not hoverable when I switch to my "black and white" mode (using dashes). Is there any way to keep the graph hoverable and clickable when using dashes? Or a way to make a decent looking plot in black and white without dashes?
示例系列:{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 事件作为工具提示,如下所示:
I use plothover event for tooltips like this:
$(this).bind("plotclick", function (event, pos, item){//这里是工具提示代码}
推荐答案
参见 this issue 针对 jQuery.flot.dashes
插件填写.
See this issue filled against the jQuery.flot.dashes
plugin.
关于悬停问题,有一个名为findNearbyItem"的函数在 jquery.flot.js 中,仅当绘图显示时才执行搜索线、点或条.如果您只显示破折号",那么它不会执行搜索.
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.
两种选择:
- 修改 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 }}
我同意发帖者的观点,即第二种解决方案是一个更好的主意.我也试过 in this fiddle 并且效果很好.
I agree with the poster that the second solution is a better idea. I've also tried it out in this fiddle and is works well.
这篇关于jquery.flot.dashes.js 是否支持 plothover 和 plotclick?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:jquery.flot.dashes.js 是否支持 plothover 和 plotclick?


- 为什么我的页面无法在 Github 上加载? 2022-01-01
- 是否可以将标志传递给 Gulp 以使其以不同的方式 2022-01-01
- 使用 iframe URL 的 jQuery UI 对话框 2022-01-01
- 如何调试 CSS/Javascript 悬停问题 2022-01-01
- 在不使用循环的情况下查找数字数组中的一项 2022-01-01
- 如何显示带有换行符的文本标签? 2022-01-01
- 如何向 ipc 渲染器发送添加回调 2022-01-01
- 我不能使用 json 使用 react 向我的 web api 发出 Post 请求 2022-01-01
- 从原点悬停时触发 translateY() 2022-01-01
- 为什么悬停在委托事件处理程序中不起作用? 2022-01-01