Published
Edited
Apr 21, 2021
Insert cell
Insert cell
gdeltDataFile = FileAttachment("gpi_gdelt_all_countries_rf_results.csv").csv()
Insert cell
Insert cell
ccodes = FileAttachment("country-codes_csv.csv").csv()
Insert cell
parseTime = d3.timeParse("%Y%m")
Insert cell
formatTime = d3.timeFormat("%m-%Y")
Insert cell
world = FileAttachment("world.json").json()
Insert cell
countries = topojson.feature(world, world.objects.countries)
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
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
configuration = ({
// https://vega.github.io/vega/docs/specification/
autosize: { type: 'fit-x', contains: 'padding' },
padding: { top: 20, bottom: 50, left: 12 },
legend: {
titleFontSize: 10,
titleColor: "#81858C",
labelFontSize: 10,
direction: 'horizontal',
orient: 'top-right',
padding: 5,
offset: 5,
strokeColor: "#81858C",
fillColor: 'white',
}
})
Insert cell
Insert cell
html`<svg width="50" height="50"><rect width="50" height="50" fill="url(#pattern_empty)" :opacity="1" /></svg>`
Insert cell
path = html // define stripes
`
<svg xmlns="http://www.w3.org/2000/svg" width="1" height="1">
<defs>
<pattern id="pattern_empty" patternUnits="userSpaceOnUse" width="${3 +
3 / 2}" height="${3 + 3 / 2}" patternTransform="rotate(${45})">
<line x1="0" y="0" x2="0" y2="${3 +
3 / 2}" stroke=${'#cfcfcf'} stroke-width="${3}" />
</pattern>
</defs>
</svg>
`
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
d3 = require('d3')
Insert cell
topojson = require('topojson')
Insert cell
import { slider } from "@jashkenas/inputs"
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