Published
Edited
Jun 16, 2021
1 fork
4 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Plot.plot({
width: width,
height: '600',
marginBottom: '60',
x: {
domain: [...variableCategories],
tickRotate: 35,
label: null,
},
y: {
grid: true,
percent: true,
},
marks: [
Plot.barY(data, Plot.stackY({
x: variablesByName.get(variable),
y: "value",
fill: variablesByName.get(secondaryVariable),
title: variablesByName.get(secondaryVariable),
offset: "expand"
})),
Plot.ruleY([0])
]
})
Insert cell
Insert cell
Insert cell
data = {
const variableList = variable == secondaryVariable ? [variable] : [variable, secondaryVariable];
const response = await queryCantabularGraphQL(ENDPOINT, QUERY, {
'dataset': DATASET,
'variables': variableList
});
return processCounts(response.data.dataset.table);
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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