Public
Edited
Apr 17, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
viewof runthis = {
yield md`<div id="description"> </div>`
let testfn = function(event) {
event.stopPropagation();
event.preventDefault();
let lbl = event.target.innerHTML ? event.target.innerHTML : event.target.nextSibling.nextSibling.innerHTML //
console.log('innerText', lbl)
document.querySelector('#description').innerHTML = event.target.innerHTML
// event.removeEventListener("click", testfn)
}
let polygons = Array.from(document.querySelectorAll("polygon")); polygons.shift();
let ellipses = Array.from(document.querySelectorAll("ellipse"));
for (const line of [...ellipses, ...polygons]) {
line.style = "cursor: pointer; fill: yellow;";
// line.style.background = "linear-gradient(to right, red, green)";
line.addEventListener('click', testfn )
}
let text = Array.from(document.querySelectorAll("ellipse"));
for (const line of Array.from(document.querySelectorAll("text")) ) {
line.addEventListener('click', testfn )
}
}

Insert cell
Array.from(document.querySelectorAll("polygon"))
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