Published unlisted
Edited
Aug 18, 2019
Fork of Asia Map
Insert cell
Insert cell
Insert cell
Insert cell
chart = {

var width = 1000,
height = 590;

//const context = DOM.context2d(width, height);

// draw svg
var svg = d3.select(DOM.element('svg'))
.attr("width", width)
.attr("height", height);
// draw svg
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);

// map projection
var projection = d3.geoPatterson()
.center([58,54])
.scale(520)
.translate([0,0])
.precision(.1);

// path generator
var path = d3.geoPath()
.projection(projection);

d3.json("asia.json", function(error, asia) {
var subunits = topojson.feature(asia, asia.objects.subunits);
svg.selectAll(".subunit")
.data(subunits.features)
.enter()
.append("path")
.attr("class", function(d) { return "subunit " + d.id; })
.attr("d", path);

});
var width = 1000,
height = 590;

// draw svg
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);

// map projection
var projection = d3.geoPatterson()
.center([58,54])
.scale(520)
.translate([0,0])
.precision(.1);

// path generator
var path = d3.geoPath()
.projection(projection);

d3.json("asia_json", function(error, asia) {
var subunits = topojson.feature(asia, asia.objects.subunits);
svg.selectAll(".subunit")
.data(subunits.features)
.enter()
.append("path")
.attr("class", function(d) { return "subunit " + d.id; })
.attr("d", path);

});

return svg.node();
// return context.canvas;
}
Insert cell
asia_json = d3.json("https://cors-anywhere.herokuapp.com/https://gist.githubusercontent.com/dhoboy/ff8448ace9d5d567390a/raw/f98a7b12ec0005f72641696752a96d1ccd73ed22/asia.json")
Insert cell
topojson = require('topojson')
Insert cell
d3 = require('d3', 'd3-geo', 'd3-geo-projection')
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