Published
Edited
Sep 20, 2022
1 fork
4 stars
Insert cell
Insert cell
domain = [0, 10]
Insert cell
scale = d3.scaleSequential(domain, d3.interpolateReds);
Insert cell
viewof i = Inputs.range(domain, {label: "Change color"})
Insert cell
myTable = {
const node = htl.html`<table>
<tr><td>Hello</td><td class="you">Oliver</td></tr>
<tr><td>Love,</td><td class="me">Toph</td></tr>
</table>`;

// Set background color for your name to constant color
d3.select(node).select(".you").style("background-color", scale(1));
// Set background color for my name to change with the slider
d3.select(node).select(".me").style("background-color", scale(i));

return node;
}
Insert cell
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