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){ //tooltip code here }

在此处输入图像描述

在此处输入图像描述

根据jQuery.flot.dashes插件查看此问题 。

关于hover问题,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 }}

我同意海报,第二个解决方案是一个更好的主意。 我也试过这个小提琴并且效果很好 。