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

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more