Skip to content

Non null flat line joining when no data #317

Answered by dbuezas
Thlerry asked this question in Q&A
Discussion options

You must be logged in to vote

Oh I see, you are right, it is working. So it is not that the sensor has "unavailable" datapoints, they are just missing. In this case, joining the lines is actually reasonable behaviour. What you can do is add an extra fake datapoint

filters:
  - fn: |- 
      ({xs, ys}) => ({
          xs: xs.flatMap((x, i) => ys[i+1] === null ? [x,x]:[x]),
          ys: ys.flatMap((y, i) => ys[i+1] === null ? [y,null]:[y])
      })

This will insert an extra undefined to the ys array, but set its date to that of the last known value. This should make the gap as wide as the whole missing chunk

Replies: 26 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@dbuezas
Comment options

Answer selected by dbuezas
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@dbuezas
Comment options

@Thlerry
Comment options

@dbuezas
Comment options

@Thlerry
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants
Converted from issue

This discussion was converted from issue #316 on October 17, 2023 16:46.