Published
Edited
Feb 25, 2019
Also listed in…
Chicago Crimes
Insert cell
Insert cell
charts = {
const locations = ['STREET', 'RESIDENCE', 'APARTMENT', 'SIDEWALK', 'OTHER'];
const charts = locations.map(location => plotMonthlyData(locationData[location], location));
return Promise.all(charts);
}
Insert cell
html `
<div style="display: inline-block; vertical-align: top; padding: 10px;">
${charts.map(c => c)}
</div>
`
Insert cell
html `
<h2>Top 30 Locations</h2>
<div>${Object.keys(locationData)
.map(locationType => textCloud(locationData, locationType))
.sort((a, b) => b.count - a.count)
.slice(0, 30) // top 30
.map(c => c.html)}
...
</div>
<h3>Total Crimes: ${Object.keys(locationData)
.map(key => locationData[key].length)
.reduce((total, num) => total + num)
.toLocaleString()}
</h3>
<hr />
`
Insert cell
Insert cell
Insert cell
dataTable = loadData(dataUrl).then(buffer => arrow.Table.from(new Uint8Array(buffer)))
Insert cell
locationData = groupByField(dataTable, 'LocationDescription')
Insert cell
import {loadData} from '@randomfractals/apache-arrow'
Insert cell
import {groupByField, textCloud, plotMonthlyData} from '@randomfractals/chicago-crimes-by-type'
Insert cell
arrow = require('apache-arrow@0.3.1')
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