Published
Edited
Mar 27, 2019
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
maxTimeDiff = 13 * 60 * 1000 // 13 minutes in milliseconds
Insert cell
tcDataWithNull = {
return _.reduce(tcData, (acc, value, i, coll) => {
let nullData;
if (i > 0) {
const thisMoment = moment(coll[i].x), prevMoment = moment(coll[i-1].x);
if (thisMoment.diff(prevMoment) > maxTimeDiff) {
nullData = {x: moment(prevMoment.valueOf() + maxTimeDiff).format('YYYY-MM-DDTHH:mm:ss.SSS[Z]'), y: null};
}
}
return _.concat(acc, nullData ? [nullData, value] : [value]);
}, []);
}
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more