Public
Edited
Jan 31, 2021
Insert cell
zh_title = md`# Chinese rivers`
Insert cell
zh_intro = md`Here is a simplified hydrographic network`
Insert cell
zhmap_bs = {
const geoGenerator = d3.geoPath().projection(projection);
const svg = d3
.select(DOM.svg(width, height))
.attr('id', 'ditu')
.style("width", "100%")
.style("height", "auto");

const zoom = d3
.zoom()
.scaleExtent([1, 300])
.translateExtent([[0, 0], [width, height]])
.on("zoom", event => {
const t = event.transform;
layers.attr("transform", t);
});

const layers = svg.append('g').attr('class', 'layers');
const fond = layers
.append('rect')
.attr('x', 0)
.attr('y', 0)
.attr('height', height)
.attr('width', width)
.attr('stroke', 'rgba(255,255,255,1)')
.attr('fill', 'rgba(255,255,255,1)')
.on("mousemove", function(event, d) {
// locator(event, d, this);
});
const rive = layers.append('g').attr("id", "rivers");

const rivers = function() {
rive
.selectAll('path')
.data(riviere.features)
.enter()
.append("path")
.attr("stroke-width", 0.1)
.attr("class", "rivers")
.attr("stroke", "blue")
.attr("fill", "white")
.attr("d", geoGenerator);
};
rivers();

svg
.append('text')
.attr('x', 20)
.attr('y', height - 10)
.append('tspan')
.attr('id', 'coo')
.attr("font-size", "12");

layers.call(zoom);

return svg.node();
}
Insert cell
projection = d3
.geoOrthographic()
.scale(1200)
.rotate([-105, -35])
.translate([width / 2, height / 2])
.clipAngle(90)
Insert cell
width = 960
Insert cell
height = 860
Insert cell
riviere = topojson.feature(river, river.objects.zhrivers)
Insert cell
import { river } from "@jipexu/underground-library"
Insert cell
d3 = require("https://d3js.org/d3.v6.min.js")
Insert cell
topojson = require("https://unpkg.com/topojson@3.0.2/dist/topojson.js")
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