Published
Edited
Oct 23, 2020
3 forks
47 stars
Insert cell
Insert cell
Insert cell
Insert cell
filteredState = _.find(statesData, d => d.id === filter)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
_.sortBy(renderData.render, 'text')
Insert cell
Insert cell
colors = new Object({
gray: '#AEA2B1',
black: '#47535C',
highlight: '#FFED6B',
})
Insert cell
colorScale = chroma.scale(["#ff8464", "#41c6fa"].map(color => chroma(color).saturate(2))).mode('lch')
Insert cell
linearGradient = (selection, id, colors, x1, x2, y1, y2) => {
selection.append('defs')
.append('linearGradient')
.attr('id', id)
.attr('gradientUnits', 'userSpaceOnUse')
.attr('x1', x1).attr('x2', x2)
.attr('y1', y1).attr('y2', y2)
.selectAll('stop')
.data(colors).join('stop')
.attr('offset', (d, i) => `${Math.floor(i * 100 / (colors.length - 1))}%`)
.attr('stop-color', d => d.color)
.attr('stop-opacity', d => d.opacity > -1 ? d.opacity : 1)
}
Insert cell
Insert cell
d3 = require('d3')
Insert cell
_ = require('lodash')
Insert cell
chroma = require('chroma-js')
Insert cell
Insert cell
Insert cell
countiesData = data.counties[year]
Insert cell
statesData = data.states[year]
Insert cell
import {scrollSVG} from '@sxywu/utility-functions'
Insert cell
import {form} from "@mbostock/form-input"
Insert cell
import {rangeSlider} from '@mootari/range-slider'
Insert cell
import {inputsGroup} from '@bumbeishvili/input-groups'
Insert cell
years = [2016, 2018]
Insert cell
style = html`
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:wght@900&family=Work+Sans:wght@400;500;700;900&display=swap" rel="stylesheet">

<style>
body, select, option {
font-family: 'Work Sans', sans-serif;
line-height: 1.5;
}

h1, h2 {
font-family: 'Playfair Display', serif;
}

select {
padding: 2px 5px;
font-size: 16px;
}

label {
display: inline-block;
min-width: 300px;
}

.highlight {
display: inline-block;
background-color: ${colors.highlight};
padding: 0px 10px;
margin-top: 5px;
border-radius: 5px;
}
</style>
`
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