Published
Edited
Apr 25, 2019
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
boston311 = d3.csv('https://gist.githubusercontent.com/cesandoval/046a91586ae76889aeb5b3e9db53016e/raw/ffb0c410ce8503c8c839cde01235bafb39cb14ad/bostosn_311.csv')
Insert cell
subMethod={
return boston311.columns.slice(2,8)
}
Insert cell
Insert cell
Insert cell
Insert cell
boston311_clean=boston311.slice(0,25)
Insert cell
z = require('https://bundle.run/zebras@0.0.11')
Insert cell
Insert cell
x = d3.scaleLinear()
.domain([0, d3.max(data, d => d.value)])
.range([margin.left, width - margin.right])
Insert cell
y = d3.scaleBand()
.domain(data.map(d => d.type))
.range([height - margin.bottom, margin.top])
.padding(0.1)
Insert cell
height = data.length * 40 + margin.top + margin.bottom
Insert cell
margin = ({top: 10, right: 0, bottom: 20, left: 40})
Insert cell
Insert cell
Insert cell
width2=900
Insert cell
height2=600
Insert cell
Insert cell
bos_geoPath=d3.geoPath()
.projection(bosProjection)
Insert cell
color = d3.scaleQuantize()
.domain([0,10])
.range(d3.schemePurples[9]);
Insert cell
bostonTotal_data={
var tem=z.parseNums(["tot_count "], boston311_clean)
var tem2=z.addCol("tot_count", z.getCol("tot_count ", tem), tem)
return tem2
}
Insert cell
colored_boston311={
const colorBy311={}
bostonTotal_data.forEach(d=>(colorBy311[d.Name]=color(Math.log(d.tot_count))))
return colorBy311
}
Insert cell
Insert cell
Insert cell
data2 = Object.assign(new Map(await format), {title: "Total Reports per neighborhood(Log Scale)"})
Insert cell
nameList=z.getCol(["Name"],bostonTotal_data)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
d3 = require("d3@5")
Insert cell
topojson = require("topojson-client@3")
Insert cell
import {chart as choropleth} from "@chagel/d3-choropleth"
Insert cell
boston = d3.json('https://gist.githubusercontent.com/cesandoval/09b2e39263c748fbcb84b927cecc7c46/raw/ab71d3638efd2545ec99c2651c6f2ddcea9d2a07/boston.json')
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