为什么以下范围功能...
d3.time.minute.range(
new Date('Sat Aug 17 2013 00:00:00 GMT-0400'),
new Date('Sat Aug 17 2013 06:00:00 GMT-0400'),
22);
...返回一个这样的数组...
[
Sat Aug 17 2013 00:00:00 GMT-0400 (Eastern Daylight Time),
Sat Aug 17 2013 00:22:00 GMT-0400 (Eastern Daylight Time),
Sat Aug 17 2013 00:44:00 GMT-0400 (Eastern Daylight Time),
Sat Aug 17 2013 01:00:00 GMT-0400 (Eastern Daylight Time), // << normalized to 1am
Sat Aug 17 2013 01:22:00 GMT-0400 (Eastern Daylight Time),
Sat Aug 17 2013 01:44:00 GMT-0400 (Eastern Daylight Time),
Sat Aug 17 2013 02:00:00 GMT-0400 (Eastern Daylight Time), // << normalized to 2am
...
]
...而不是像这样?
[
Sat Aug 17 2013 00:00:00 GMT-0400 (Eastern Daylight Time),
Sat Aug 17 2013 00:22:00 GMT-0400 (Eastern Daylight Time),
Sat Aug 17 2013 00:44:00 GMT-0400 (Eastern Daylight Time),
Sat Aug 17 2013 01:06:00 GMT-0400 (Eastern Daylight Time),
Sat Aug 17 2013 01:28:00 GMT-0400 (Eastern Daylight Time),
Sat Aug 17 2013 01:50:00 GMT-0400 (Eastern Daylight Time),
Sat Aug 17 2013 02:12:00 GMT-0400 (Eastern Daylight Time),
...
]
我正在尝试渲染时间线,然后用于d3.time.scale
关联像素和时间。rect
在这个例子中,我渲染的每个代表 22 分钟。当我绑定.data()
到这个范围函数的结果时,我的text
元素在所有情况下都不能清楚地表示实际时间。
d3.time.minute.range
如果我自己避免使用并简单地添加 22 分钟 ( ) ,我会遇到什么样的问题.getTime() + 22 * 60 * 1000
?