我在锁定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 -
答案 0 :(得分:1)
我超级棒的程序员朋友Jeremy Pepper向我提到了两件事:
1。)锁定似乎将选择锁定到特定系列,而不是锁定整个图形。
2。)
graph.mouseMove_ = doNothing;
function doNothing()
{
}
作品。我不知道为什么这个解决方案让我觉得很脏...