Public
Edited
Jul 24, 2024
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
graph = parsePg(pgText)
Insert cell
dot`graph {
a [label=<<i>test</i>>];
a -- b [label=< <i>test</i> >];
}`
Insert cell
Insert cell
Insert cell
formats = ({
dot: { serialize: serializeDot, nodeName: "label", edgeName: "label" },
mmd: { serialize: serializeMermaid, nodeName: "name", edgeName: "name" }
})
Insert cell
Insert cell
editor = {
while (editorDiv.firstChild) { editorDiv.removeChild(editorDiv.firstChild); }
let editor = CodeMirror(editorDiv, { mode: "pg" })
editor.setValue(`pg -> example :editor key:value`)
editor.setSize(width - 20, 150)
return editor
}
Insert cell
pgText = Generators.observe(change => {
change(editor.getValue())
editor.on('change', () => change(editor.getValue()))
})
Insert cell
Insert cell
Insert cell
parsePg = (await import("https://unpkg.com/pgraphs@0.6.15/src/format/pg/parser.js")).parse
Insert cell
serializeMermaid = (await import("https://unpkg.com/pgraphs@0.6.15/src/format/mermaid/serialize.js")).default
Insert cell
serializeDot = (await import("https://unpkg.com/pgraphs@0.6.15/src/format/dot/serialize.js")).default
Insert cell
addHtmlSummary = (await import("https://unpkg.com/pgraphs@0.6.15/src/transform.js")).addHtmlSummary
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