gpt4 book ai didi

javascript - jquery.flot.dashes.js 是否支持 plothover 和 plotclick?

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:24:20 24 4
gpt4 key购买 nike

通过使用 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){
//工具提示代码在这里
}

enter image description here

enter image description here

最佳答案

参见 this issue针对 jQuery.flot.dashes 插件进行填充。

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.dashes.js 是否支持 plothover 和 plotclick?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24593077/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com