Published
Edited
Feb 25, 2019
Also listed in…
Vega
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

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