Public
Edited
May 22, 2023
Insert cell
Insert cell
Insert cell
Insert cell
showMe(`
`, {
label: 'About the Global Terrorism Database',
evaluate: false,
styles: {maxWidth:width + "px"}
}
)
Insert cell
Insert cell
GTOverview
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
AttackDataImport= FileAttachment("terroristdata_1990-2020V2.csv").csv()
Insert cell
AttackDataImport
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
Insert cell
WrangledAttackDataImport = // To use copied code replace "data" with your own variable
aq.from(AttackDataImport)
.select('iyear','country_txt','region_txt','provstate','city','latitude','longitude','attacktype1_txt','targtype1_txt','corp1','target1','natlty1_txt','gname','claimed','weaptype1_txt','nkill','nwound')
.rename({iyear: "year"})
.rename({nkill: "kills"})
.rename({country_txt: "country"})
.rename({provstate: "province/state"})
.rename({nwound: "wounded"})
.rename({region_txt: "region"})
.rename({attacktype1_txt: "attacktype"})
.rename({weaptype1_txt: "weapontype"})
.rename({targtype1_txt: "targettype"})
.rename({natlty1_txt: "nationality"})
.rename({gname: "organisation"})
.filter(d => d["organisation"] !== "Unknown")
.objects() // Uncomment to return an array of objects
Insert cell
WrangledAttackDataImport
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
import {map as GTOverview} with {data1final as data} from "@d3/world-airports"
Insert cell
data1final = aq.from(WrangledAttackDataImport)
.params({
yearStart: new Date(+control_timeRange[0], 0, 1).getFullYear(),
yearEnd: new Date(+control_timeRange[1], 0, 0).getFullYear()
})
.filter ( (d, params) => d["year"] >= params.yearStart)
.filter ( (d, params) => d["year"] <= params.yearEnd)
.objects()
Insert cell
Insert cell
import {toc} from "@nebrius/indented-toc"
Insert cell
import {Wrangler, op} from "@observablehq/data-wrangler"
Insert cell
import {rangeSlider} from '@mootari/range-slider'
Insert cell
import {showMe} from "@observablehq/show-me"
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