Public
Edited
Oct 21, 2021
2 stars
Insert cell
Insert cell
Insert cell
viewof genomeSpy = embed({
height: 200,
width: 400,

data: { values: data },

mark: { type: "point", clip: false },

encoding: {
x: {
field: "x",
type: "quantitative",
scale: {
// Let's give the scale a name
name: "x_scale",
// ... and make it zoomable
zoom: true
}
},
y: { field: "sin", type: "quantitative" }
}
})
Insert cell
Insert cell
Insert cell
Generators.observe((change) => {
const clicked = (event) => change(event);
genomeSpy.addEventListener("click", clicked);
change(undefined);
return () => genomeSpy.removeEventListener("click", clicked);
})
Insert cell
Insert cell
Insert cell
Generators.observe((change) => {
const scaleResolution = genomeSpy.getScaleResolutionByName("x_scale");
const domainChanged = (event) => change(event.scaleResolution.getDomain());
scaleResolution.addEventListener("domain", domainChanged);
change(scaleResolution.getDomain());
return () => scaleResolution.removeEventListener("domain", domainChanged);
})
Insert cell
Insert cell
Insert cell
import {embed, data } from "@tuner/genomespy"
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