Remove the concept of lag from observed line api #54
Description
The essence of observed line is in having a time series of length t at time
t. When we move ahead to time t + 1, we have now a new time series of length
t + 1 which might have nothing in common with the old t points.
The plotting API for timeChart
uses the idea of lag to work with this concept. For
example, here is the (minimal) data it expects to show the observed series for 3
steps.
let observedExample = [
[ { lag: 2, value: 0.88 }, { lag: 1, value: 0.88 }, { lag: 0, value: 0.93 }],
[ { lag: 1, value: 1.11 }, { lag: 0, value: 1.32 } ],
[ { lag: 0, value: 1.13 } ]
]
When we show time step 1, we pick lag 0 for time 1 ( [ { lag: 0, value: 0.93 } ]
). At time 2, we pick lag 1 from time 1 and lag 0 from time 2 ( [ { lag: 1, value: 0.88 }, { lag: 0, value: 1.32 } ]
) and so on.
One problem with this approach is that d3-foresight has to figure out a way to
handle missing lag values. This problem is not a visualization problem if we
have at least 2 interpretations of missing lags (which we have) so might be
better solved outside this library.
A possibly better solution might involve passing a list of series to timeChart
something like the following (null means we don't want to show any observed line
at that point):
let observedNew = [
[0.93],
[0.88, 1.32],
[1.13, 1.11, 0.88],
null,
null,
...
]