Unlisted
Edited
Jun 10, 2024
Insert cell
Insert cell
Insert cell
dot`digraph g {
rankdir = LR;
a [label="One\ntwo"]
a -> b -> c;
}`
Insert cell
Insert cell
function wordWrap(s, { maxLength = 20 } = {}) {
const words = s.split(/\s+/);
const lines = [words[0]];
for (const word of words.slice(1)) {
if (lines[lines.length - 1].length + word.length < maxLength) {
if (lines.length > 0) lines[lines.length - 1] += " ";
lines[lines.length - 1] += word;
} else {
lines.push(word);
}
}
return lines.join("\n");
}
Insert cell
Insert cell
Insert cell
Insert cell
example = dot`digraph g {
rankdir = LR;
a [label="${wordWrap("One two", { maxLength: 3 })}"]
a -> b -> c;
}`
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