Public
Edited
Jun 14, 2023
Fork of Word cloud
1 fork
Insert cell
Insert cell
_.countBy(nocoOutput, "chatId")
Insert cell
WordCloud(text, {
width,
height: 500,
invalidation // a promise to stop the simulation when the cell is re-run
})
Insert cell
Insert cell
viewof text = Inputs.textarea({
value: labelsByChatId("15f20c084478c0018a070d0662627e38087df501"),
rows: 10,
width
})
Insert cell
WordCloud(labelsByChatId("d81e5e870bf2c91315a44d163e4aa0ca7c6e3406"), {
width,
height: 500,
invalidation
})
Insert cell
function labelsByChatId(chatId) {
const selected = _.filter(nocoOutput, { chatId });
const labels = _.map(selected, "label");
let textString = "";
_.each(labels, function (l) {
textString += ` ${l.replace(/\ /, "_")}`;
});
return textString;
}
Insert cell
nocoOutput = FileAttachment("noco-output.json").json()
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

Insert cell
WordCloud("Hello, World! This is a small cloud for your enjoyment", {
width: 250,
height: 100,
size: () => .3 + Math.random(),
rotate: () => (~~(Math.random() * 6) - 3) * 30
})
Insert cell
d3Cloud = require("d3-cloud@1")
Insert cell
import {howto} from "@d3/example-components"
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