锁定在 setSelection() 上的代码图不起作用

Dygraphs locking on setSelection() isn't working

本文关键字:代码 不起作用 setSelection 锁定      更新时间:2023-09-26

我在锁定setSelection()时遇到问题。选择正确的值没有问题,但之后图形未被锁定。

我试过:

graph = new Dygraph(satgraph, data, { labels: [ "Score", "Percentage of people at this score"] });
.
.
.
graph.setSelection(intoStepSpace, { locked: [true] });
graph.setSelection(intoStepSpace, "", true); 
graph.setSelection(intoStepSpace, null, true);
graph.setSelection(intoStepSpace, undefined, true);
and, just in case they want a highlightSeriesOpts instead of the name of a series:
graph.setSelection(intoStepSpace, { highlightSeriesOpts: [
   {strokeWidth: 3},
   {strokeBorderWidth: 1},
   {highlightCircleSize: 5}]
 }, true);}

这些都是单独尝试的,而不是像上面的代码显示的那样按顺序尝试。

很可能,这是我对 JavaScript 中的可选参数理解不够好的问题,但在阅读了这个概念之后,我认为我是正确的。任何人都清楚我做错了什么吗?我已经很久没有使用JavaScript了,我很高兴使用Dygraphs重新进入它。

非常感谢您的帮助。

-

布莱恩·斯蒂纳-

我的超级棒程序员朋友Jeremy Pepper向我提到了两件事:

1.) 锁定似乎将所选内容锁定到特定系列,而不是锁定整个图形。

2.)

graph.mouseMove_ = doNothing;
function doNothing()
{
}

工程。我不知道为什么这个解决方案让我觉得很脏...