Published
Edited
Nov 7, 2021
1 star
Insert cell
Insert cell
Insert cell
function kFormatter(num) {
return Math.abs(num) > 999
? Math.sign(num) * (Math.abs(num) / 1000).toFixed(1)
: Math.sign(num) * Math.abs(num);
}
Insert cell
d3 = require("d3@6", "d3-tile@1")
Insert cell
station = FileAttachment("station_info.json").json()
Insert cell
railroadSection = FileAttachment("tokyoRailroad.json").json()
Insert cell
url = (x, y, z) =>
`https://api.mapbox.com/styles/v1/mapbox/dark-v10/tiles/${z}/${x}/${y}${
devicePixelRatio > 1 ? "@2x" : ""
}?access_token=pk.eyJ1Ijoia2VudGFybzExIiwiYSI6ImNrcWMxdnB2NTFmMG4zMm12ZWxic3kwbWwifQ.tl4d6iP4wrUkRoBmOfM-IQ`
Insert cell
import { Legend } from "@d3/color-legend"
Insert cell
html`
<style>

.stationCircle {
stroke-width: 0.1;
}
.railroadPath {
fill: none;
}

.stationDescGroup {
pointer-events: none;
}
.staionTooltipFrame {
fill: white;
stroke: #8b8b8b;
}

.stationDesc {
dominant-baseline: middle;
text-anchor: middle;
font-size: small;
fill: #8b8b8b;
}

.legend-left-text{
dominant-baseline: middle;
text-anchor: end;
fill: white;
font-size:0.8rem;
font-weight:bold;

}

.legend-right-text{
dominant-baseline: middle;
text-anchor: start;
fill: white;
font-size:0.8rem;
font-weight:bold;

}

.legend-title{
dominant-baseline: middle;
text-anchor: middle;
fill: white;
font-size:1rem;
font-weight:bold;

}

.backgroundMap{
opacity:0.45
}


</sytle>
`
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