1

我在锁定 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 重新开始使用它。

非常感谢你的帮助。

-Brian J. Stinar-

4

1 回答 1

1

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

1.)锁定似乎将选择锁定到特定系列,而不是锁定整个图表。

2.)

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

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

于 2013-01-24T06:54:31.580 回答