Dygraphs:在我的时间序列中添加注释

jtr*_*ans 5 datetime time-series dygraphs

我继续玩Dygraphs的时间序列.我已经按照这里的文档:http: //dygraphs.com/annotations.html 和这里:http://dygraphs.com/gallery/#g/annotations

我的x轴是一个javascript Date()对象.经过检查,我与Dygraphs一起使用的时间序列数组示例如下:

[[Wed Sep 25 2013 00:00:00 GMT+0100 (GMT Daylight Time), 5.311174814188838, 11],
[Wed Sep 25 2013 01:00:00 GMT+0100 (GMT Daylight Time), 5.313242976801092, 11],
[Wed Sep 25 2013 02:00:00 GMT+0100 (GMT Daylight Time), 5.310303423288409, 11],
[Wed Sep 25 2013 03:00:00 GMT+0100 (GMT Daylight Time), 5.301762506225051, 11]]
Run Code Online (Sandbox Code Playgroud)

该系列可以是"A"和"B".无论我如何设置注释,它都不起作用.例如,

annDate = new Date('2013 09 25');
g.setAnnotations([
{
  series: "A",
  x: annDate,
  shortText: "L",
  text: "Coldest Day"
}
]);
Run Code Online (Sandbox Code Playgroud)

我已经尝试直接将日期指定为字符串,例如"2013-09-25"等,但我无法在图表上显示注释.

编辑 小提琴: http: //jsfiddle.net/be8s6/3/

dan*_*nvk 6

这是您的示例的固定版本:http://jsfiddle.net/be8s6/4/

诀窍是将您的注释表达为:

{
  series: "A",
  x: new Date("2009/07/12 14:00").getTime(),
  shortText: "L",
  text: "Coldest Day"
}
Run Code Online (Sandbox Code Playgroud)

即该x值应该是自纪元以来的毫秒数.这无疑是有点令人困惑的.