Published
Edited
Jan 2, 2019
1 star
Insert cell
Insert cell
Insert cell
Insert cell
lbsArr = lbsStr.split("\n").filter( (item) => { return item != "" } )
Insert cell
lbsArrSplit = lbsArr.map( (str) => { return str.split(" ") })
Insert cell
lbsArrClean = lbsArrSplit.map( (arr) => { return [new Date(`${arr[0]}/2018`), +arr[1]] })
Insert cell
lbsJson = lbsArrClean.map( (arr) => {
return {
date: JSON.stringify(arr[0]).substring(1,11),
lbs: arr[1]
}})
Insert cell
JSON.stringify(lbsJson).replace(/,{/g, ",\n{")
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

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