1
我想使用培根将时间序列与不规则的时间戳结合在一个EventStream中。每个事件将包含给定时间的每个时间序列的最后一个值。 下面是一个例子bacon.js中的对齐时间序列
var ts1 = new Bacon.fromArray([
[1,2], //Each array is an event,i.e here timestamp is 1 and value is 2
[2,3],
[5,9]
])
var ts2 = new Bacon.fromArray([
[4,2],
[9,3],
[12,9]
])
我想有是这样的
var ts12 =[
[1,2,undefined], //At time 1, only ts1 was defined
[2,3,undefined],
[4,3,2], //at time 4, we take the last value of ts1 (3) and ts2 (2)
[5,9,2],
[9,9,3],
[12,9,9],
]
我尝试了用Bacon.update,但我没去很远的地方实施。你会如何处理这个问题?
这些时间序列可以预先完整地提供,就像它们在示例中一样,或者它们的值在运行时是否以事件形式出现?在前一种情况下,完全跳过培根可能会更容易,只需合并对两个数组进行排序即可。 – 2014-09-02 07:10:52