Published
Edited
Jan 19, 2022
4 stars
Insert cell
Insert cell
myList = [1, 2, 3]
Insert cell
Insert cell
chart = svg`<svg width="${width}" height="20">
<circle r="10" cx="${width / 2}" cy="10" />
</svg>`
Insert cell
Insert cell
chart
Insert cell
chart.getBoundingClientRect().width
Insert cell
chart.outerHTML
Insert cell
Insert cell
chart2 = {
const x = (width / 2) * Math.sin(now / 1000);

// this logs the value of x to the cell below
// every time the cell runs, which happens
// whenever `now` changes
mutable debug = x;

return svg`<svg width="${width}" height="20">
<g transform="translate(${width / 2}, 10)">
<circle r="10" cx="${x}" />
</g>
</svg>`;
}
Insert cell
mutable debug = null
Insert cell
Insert cell
prettier = require("prettier@2", "prettier@2/parser-html.js")
Insert cell
~~~html
${prettier.format(chart2.outerHTML, {
parser: "html",
plugins: [prettier]
})}
~~~
Insert cell
Insert cell
Insert cell
chart.__proto__
Insert cell
Insert cell
new DocumentFragment()
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