Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
chart960 = chart(960)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
values = d3.merge(geojsonData.features.map(
d => Object.entries(d.properties).map(
([key, value]) => {
if (candidates.includes(key)) {
return value;
}
}).filter(Number.isFinite)))
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
viewof cities = checkbox({
title: "Cities to add to the map",
options: cityList.map(d => d.name).sort(),
value: [
"Downtown",
"Culver City",
"Carson",
"Inglewood",
"Leimert Park",
]
})
Insert cell
Insert cell
colors = ({
chan_jeong: '#d95f02',
holly_mitchell: '#7570b3',
jan_perry: '#e7298a',
herb_wesson: '#1b9e77',
})
Insert cell
Insert cell
groups = ckmeans(values, breaks).map(d => d3.min(d))
Insert cell
Insert cell
Insert cell
Insert cell
colorScale = d3.scaleThreshold(groups, colorPalette.slice(1, colorPalette.length))
Insert cell
Insert cell
cityList = [
{
name: 'Leimert Park',
type: 'neighborhood',
coordinates: [-118.3307598, 34.0131431],
},
{
name: 'Carson',
type: 'city',
coordinates: [-118.28202, 33.83141],
},
{
name: "Long Beach",
type: 'city',
coordinates: [-118.21426391601561, 33.804255802014865],
},
{
name: "Inglewood",
type: 'city',
coordinates: [-118.355370, 33.961018],
x: "-9",
anchor: "end"
},
{
name: "Culver City",
type: 'city',
x: "-9",
anchor: "end",
coordinates: [-118.3964665, 34.0211224],
},
{
name: "Compton",
type: 'city',
coordinates: [-118.220070, 33.895847]
},
{
name: "Lancaster",
type: 'city',
coordinates: [-118.157958984375, 34.69476751842919]
},
{
name: "Beverly Hills",
type: 'city',
coordinates: [-118.3993148803711, 34.073706174064164]
},
{
name: "West Hollywood",
type: 'city',
coordinates: [-118.35708618164064, 34.091620235447365]
},
{
name: "Arcadia",
type: 'city',
coordinates: [-118.03779602050781, 34.13709922600642]
},
{
name: "Santa Monica",
type: 'city',
coordinates: [-118.48342895507812, 34.011119420618684],
x: "-9",
anchor: "end"
},
{
name: 'Pasadena',
type: 'city',
coordinates: [-118.14452, 34.14778],
},
{
name: 'Pomona',
type: 'city',
coordinates: [-117.749992, 34.055103],
x: '-9',
anchor: 'end',
}
]
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
projection = d3.geoMercator()
.center([-118.33, 33.93])
.scale((1 << 22.9999) / (26 * Math.PI))
.translate([mapWidth / 2, mapHeight / 2])
Insert cell
Insert cell
Insert cell
Insert cell
district = await d3.json('https://gist.githubusercontent.com/stiles/6e24fc5d70bf78dbcebb1878c16648d9/raw/a2f5b2949207ff3e4908a8cb4deb47ee12824df0/2nddistrict.geojson')
Insert cell
districtLabels = await d3.json('https://gist.githubusercontent.com/stiles/b7ea564c2252c1d8d813e2e66010f892/raw/864d782a889a510bef6542436baf0d737cf77ff8/district2labels.geojson')
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
async function createZIP() {
const zip = new JSZip()

const folder = zip.folder(circleValue);
folder.file('320.png', await exportPNG(chart320));
folder.file('640.png', await exportPNG(chart640));
folder.file('960.png', await exportPNG(chart960));

return zip.generateAsync({type: 'blob'})
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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