Public
Edited
Nov 8, 2022
Insert cell
Insert cell
Insert cell
viewof filterArea = Inputs.select([null].concat(areaList), {label: "Parliment Area"})
Insert cell
Inputs.table(candidateList)
Insert cell
Insert cell
viewof filterParty = Inputs.select([null].concat(partyList), {label: "Party"})
Insert cell
Inputs.table(databyParty)
Insert cell
partyList = _.uniqBy(data, d => d.parti)
.map(d => d.parti)
.sort()
Insert cell
areaList = _.uniqBy(data, d => d.nama_parlimen)
.map(d => d.nama_parlimen)
.sort()
Insert cell
candidateList = data.map(d => (
{
parti: d.parti,
nama: d.nama,
nama_parlimen: d.nama_parlimen,
kod: d.kod,
}))
.filter(d => d.nama_parlimen == filterArea )

Insert cell
databyParty = data.map(d => (
{
nama: d.nama,
grp: d.parti_full,
kod: d.kod,
parti: d.parti,
nama_parlimen: d.nama_parlimen,
}))
.filter(d => d.parti == filterParty )

Insert cell
total = _.countBy(data);
Insert cell
data = FileAttachment("candidates-pru15@1.json").json()
Insert cell
Insert cell
pru-14-parlimen-results.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

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