Published
Edited
Jun 5, 2020
Importers
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
crimeChart = {
let div = html`<div style='height:400px;'></div>`;

const mapHolder = [0];

// Like Leaflet and Mapbox GL JS, Google Maps is very picky about
// needing to be initialized on a div that's already included
// in the page. So I yield the div first, to establish it in
// the page.
yield div;
let map = new google.maps.Map(div, {
center: { lng: -122.340700, lat: 47.606925 },
zoom: 10
});
mapHolder[0] = map;

points.map(
p =>
new google.maps.Marker({
position: { lng: p.x, lat: p.y },
map: mapHolder[0]
})
);
}
Insert cell
initialCenter = [-122.340700, 47.606925]
Insert cell
google = require('https://maps.googleapis.com/maps/api/js?key=AIzaSyB4JQkUKSUqHQmteJ5xdk4RdrFqHi04hdg').catch(
() => window.google
)
Insert cell
formatTime1 = d3.timeParse("%m/%d/%Y %I:%M:%S %p")
Insert cell
points = SeattleSafety.filter(
d => formatTime1(d["Event Clearance Date"]).getFullYear() == "2016"
).map(d => {
return {
x: +d.Longitude,
y: +d.Latitude
};
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
topojson = require("topojson-client@3")
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
width2 = 900
Insert cell
Insert cell
Insert cell
import { swatches } from "@d3/color-legend"
Insert cell
md`### Crime`
Insert cell
Insert cell
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