Published
Edited
Feb 20, 2021
12 stars
Hello, PGLiteINSEE ParquetHello, apcachDruidJS workerHello, OrbitWord Tour: 40k words and their friendsHello, spectral.jsHello, petite-vueHello, @thi.ng/grid-iteratorsHello, thumbhashHello, SwissGLHello, QOI (and glitches)Hello, orbHello, cosmographHello, TabulatorUsing d3.blur with PlotMath.cbrtHello debounceColorcetHello, gliiHello, Open MeteoHello, PyWaveletsHello, typesenseHello, libgifHello, kmeans-engineHappy anniversary, Project Gutenberg!Hello, fflateHello, ArchieML!Hello, d3-bboxCollideHello, jsgeoda!Hello, EDTF!
Hello, protovis!
Hello, placekeyHello, fuse.jsHello, Reorder.jsHello, shadow DOMjszipHello, procedural-glHello, qhullHello, genetic-jsDruidJSHello, Tippy.jsHello, paintWorkletBig πHello, AutoencoderHello, Shakespearean UUIDsHello, ccwt.jsHello, constrainautorHello, talismanHello, polygon-offsetHello p-queueHello async-poolHello rollup-plugin-asciiHello, algebra.jsHello, pixi.jsHello, d3-renderHello zip/unzipCumulative Wikipedia DonationsHTML <details>regl textureHello, npyjsHello protobufHello, pencil touchHello, LOESSHello html2canvaslegra mapscolor2cssHello, ecsy2D point distributionsHello, delatinThe gpu.js loopDijkstra’s shortest-path treeHello nojacko/Dijkstras-jsHello, tcort/dijkstrajsHello, lambdabaa/dijkstraHello, gpu.js v2Hello jsqrHello qrcodeHello SharedArrayBufferHello GamePad APIHello vtk.jsHello nd4jsHello BiofabricTravelling with a self-organizing mapHello glitchHello UMAP-jsHello pandemoniumHello iocaneHello JSON-editorHello d3-griddingHello mljs/knnWorkerHello lalolibImage to GPU.jsImage to blink.jsTissot's indicatrixVega projectionsHello WebCLGLUsing d3-inertia with observableVideo contouring 3ngraph: pagerank, louvain…Union-FindPerceptron (simple statistics)mljsHello h3-jsEmoji FlagsHello, poisson-disk-sampling
Insert cell
Insert cell
pv = FileAttachment("protovis.js")
.text()
.then(d => eval(`(function() { ${d}; return pv; })()`))
Insert cell
{
new pv.Panel()
.width(150)
.height(150)
.anchor("center")
.add(pv.Label)
.text("Hello, protovis!")
.root.render();

return last();
}
Insert cell
Insert cell
{
/* Sizing and spacing parameters. */
var h = 20,
ch = 24,
cw = 11;

/* Bertin's order, grouping metrics by seasonal pattern. */
var order = [18, 17, 19, 7, 10, 3, 11, 12, 15, 13, 0, 1, 6, 8, 9, 16, 5, 2, 4, 14];

/* Compute the mean per metric. */
var type = pv.nest(hotel).key(d => d.type),
means = type.rollup(values => pv.mean(values, d => d.count));

/* The root panel. */
var vis = new pv.Panel().width(520).height(520);

/* A panel per series, with a bar chart and label. */
vis
.add(pv.Panel)
.data(pv.permute(type.entries(), order))
.top(function() {
return ch * (this.index + 1);
})
.height(h)
.add(pv.Label)
.font("13px Georgia")
.left(cw * 24 + 8)
.bottom(0)
.text((x, d) => d.key)
.add(pv.Bar)
.def("y", d => pv.Scale.linear(0, pv.max(d.values, d => d.count)))
.data(d => pv.repeat(d.values))
.left(function() {
return cw * this.index;
})
.bottom(0)
.width(cw)
.height(function(d) {
return this.y()(d.count) * h;
})
.strokeStyle("#000")
.lineWidth(1)
.antialias(false)
.fillStyle(d => (d.count > means[d.type] ? "#000" : null));

/* Month labels. */
vis
.add(pv.Label)
.data(pv.repeat("JFMAMJJASOND".split("")))
.top(function() {
return this.index % 6 > 2 ? 16 : 14;
})
.left(function() {
return cw * (this.index + .5);
})
.textAlign("center")
.font("bold 15px Arial");

vis.render();

return last();
}
Insert cell
// protovis attaches an SVG element to the DOM. Find and return it.
// (not foolproof but good enough for a vintage notebook)
function last() {
return html`${[...document.body.querySelectorAll("svg")].pop()}`;
}
Insert cell
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