Public
Edited
Jul 3, 2024
1 fork
7 stars
Insert cell
Insert cell
// patch the spec to add the signal for rotation
viewof view = embed(vlSpec, {patch: [{
path: "/signals",
op: "add",
value: [{
name: "rotation",
value: 0,
}]
}]})
Insert cell
Insert cell
Insert cell
vlSpec = ({
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"width": 500,
"height": 500,
"data": {
"url": "https://unpkg.com/world-atlas@1/world/110m.json",
"format": {
"type": "topojson",
"feature": "countries"
}
},
"projection": {
"type": "orthographic",
// this is a hack!
"rotate": [{"signal": "rotation"},0,0]
},
"mark": {
"type": "geoshape",
"fill": "lightgray",
"stroke": "black",
"strokeWidth": 0.5
}
})
Insert cell
// update the view when the rotation changes
view.signal('rotation', rotation).run()
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more