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
filterWithConstituency = rolledWithConstituency.filter(d => d.constituency == `${selectConstituency[0]}`)
Insert cell
Insert cell
filterWithParty = rolledWithConstituency.filter(d => d.party == `${selectParty[0]}`)
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
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
keysToGroupBy = [d => d.question.by.showAs, d => d.question.to.showAs, d => d.question.debateSection.showAs, d => d.contextDate, d => d.question.showAs]
Insert cell
dataWithConstituencies = ({
name: (`Questions in ${year.year}`),
children:
Array.from(
d3.rollup(filtered, v => v.length, d => d.party, d => d.constituency, d => d.department, d => d.heading),
([name, children]) => ({name, children: Array.from(children, ([name, children]) => ({name, children: Array.from(children, ([name, children]) => ({name, children: Array.from(children, ([name, value]) => ({name, value})
)}) )}))})) })
;
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
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
filtered = rolledWithConstituency.filter(d =>
d.party !== undefined, d => d.constituency !== undefined)
Insert cell
constituencyArray = Array.from(new Set(d3.group(rolledWithConstituency, d => d.constituency))).sort((a, b) => d3.ascending(a, b))
Insert cell
partyArray = Array.from(new Set(d3.group(rolledWithConstituency, d => d.party))).sort((a, b) => d3.ascending(a, b))
Insert cell
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