Published
Edited
Jul 29, 2020
7 stars
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
Insert cell
Insert cell
Insert cell
viewof userColors = {
let u = html`<div><b>User Colors: </b><div></div></div>`;
function onSnapshot(qs) {
let docs = qs.docs.map(d => {
let data = { id: d.id, ...d.data() };
return data;
});
console.log(docs);
// choice.value = docs[0].hex;

u.value = docs.map(d => d.hex);
d3.select(u)
.select("div")
.text(docs.map(d => d.hex));
u.dispatchEvent(new CustomEvent("input", { bubbles: true }));
}
// whenever the users db is modified this callback should get called
db.collection("colors")
// .get("background")
.onSnapshot(onSnapshot);
return u;
}
Insert cell
viewof moire = {
let u = html`<div><b>Moire: </b><pre></pre></div>`;
function onSnapshot(qs) {
let docs = qs.docs.map(d => {
let data = { id: d.id, ...d.data() };
return data;
});
console.log(docs);
// choice.value = docs[0].hex;

u.value = docs[0];
d3.select(u)
.select("pre")
.text(JSON.stringify(docs[0], null, 2));
u.dispatchEvent(new CustomEvent("input", { bubbles: true }));
}
// whenever the users db is modified this callback should get called
db.collection("moire")
// .get("background")
.onSnapshot(onSnapshot);
return u;
}
Insert cell
moire
Insert cell
setters = {
if (moire.theta != θ)
db.collection('moire')
.doc("stream")
.update({ theta: θ });

if (moire.layers != layers)
db.collection('moire')
.doc("stream")
.update({ layers: layers });

if (moire.scaleFactor != scale)
db.collection('moire')
.doc("stream")
.update({ scaleFactor: scale });

if (moire.spacing != spacing)
db.collection('moire')
.doc("stream")
.update({ spacing: spacing });
}
Insert cell
// width = 600;
Insert cell
Insert cell
1080 / 1920
Insert cell
Insert cell
Insert cell
Insert cell
getHexGridCircles(hexGrids[0], scale)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
app = {
let app = firebase.initializeApp(firebaseConfig);
firebase.analytics();
firebase.auth().useDeviceLanguage();
return app;
}
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