Published
Edited
Apr 22, 2021
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
function showTable(value){
let S = '<tr><td rowspan="2">Name</td><td colspan="3">Position</td><td rowspan="2">Orientation</td><td rowspan="2">Speed</td><td rowspan="2">Stamina</td></tr><tr><td>x</td><td>y</td><td>z</td></tr>'
for (const marker in value){
console.log(marker)
console.log(value[marker])
if (value[marker].hasOwnProperty('position')){
S = S + '<tr><td>' + value[marker].name + '</td><td>' +value[marker].position.x + '</td><td>' +value[marker].position.y + '</td><td>' +value[marker].position.z + '</td><td>' +value[marker].orientation + '</td><td>' +value[marker].speed + '</td><td>' + value[marker].stamina + '</td></tr>'
}
}
let table = document.querySelector('table')
table.innerHTML = S
if (table != undefined)
return "Table built !"
}
Insert cell
showTable(Data)
Insert cell
viewof serverUrl = text({
placeholder: "http://localhost:3000",
description:
'Configure the socket server URL (http://localhost:3000 if you install your <a href="https://github.com/ggroult3/linkObs">local server</a>)',
value: 'https://linkobs.herokuapp.com/'
})
Insert cell
Insert cell
Insert cell
socket = {
const socket = io(serverUrl)
socket.on('update data',function(){
var promise = d3.json("https://linkobs.herokuapp.com/sendData/foot")
console.log(promise)
promise.then((value) => {
console.log(value);
showTable(value)
draw(value)
})
})
}
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