Published
Edited
Apr 18, 2021
Importers
7 stars
Insert cell
Insert cell
Insert cell
Insert cell
instagrams = [...new Set(data.results.bindings.map(e => e.instagram.value))]
Insert cell
data = fetch(
`https://query.wikidata.org/sparql?query=${encodeURIComponent(query)}`,
{ headers: { accept: "application/sparql-results+json" } }
).then(response => response.json())
Insert cell
Insert cell
button = copyToClipboardButton
Insert cell
function copyToClipboardButton(data, title = 'copy to clipboard') {
const bt = html`<button> ${title}`;
const el = document.createElement('input');
el.style.cssText = 'padding:0;margin:0;border:0;width:1px;opacity:0';
bt.appendChild(el);
bt.onclick = async () => {
el.value = typeof data === "string" ? data : JSON.stringify(data); //if string no need to stringify
el.select();
console.log(el);
document.execCommand("copy");
};
return bt;
}
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