Published
Edited
May 7, 2021
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
dot_plot = Plot.plot({
title: "Exchange Server Release Date and Up-to-Date Status by Industry",
marginLeft: 150,
width: 900,
x: {
domain: [new Date("2012-06-01"), new Date("2021-06-01")],
label: "Release Date",
grid: true
},
y: {
label: "",
grid: true
},
color: {
range: ["#31739C", "#E85E26"]
},
marks: [
Plot.dot(
exchange,
{
x: "rls_date",
y: "industry",
fill: "supported",
r: "n"
}
)
]
})
Insert cell
Insert cell
Insert cell
Insert cell
viewof exch = aq.fromCSV(await FileAttachment('test.csv').text()).view({ height: 240 })
Insert cell
bar_plot = Plot.plot({
title: "Exchange Server Counts by Industry",
marginLeft: 150,
width: 900,
x: {
label: "# Exchange Servers",
grid: true
},
y: {
label: "",
grid: false,
domain: exch
.groupby('industry')
.rollup({ct: d => op.sum(d.n)})
.orderby(aq.desc('ct'))
.columnArray('industry')
},
marks: [
Plot.barX(
exch
.groupby('industry')
.rollup({ct: d => op.sum(d.n)}),
{
x: "ct",
y: "industry",
fill: "steelblue"
}
)
]
})
Insert cell
Insert cell
Insert cell
Insert cell
stacked_bar_plot = Plot.plot({
title: "Exchange Server Counts by Industry",
marginLeft: 150,
width: 900,
x: {
label: "# Exchange Servers",
grid: true
},
y: {
label: "",
grid: false,
domain: exch
.groupby('industry')
.rollup({ct: d => op.sum(d.n)})
.orderby(aq.desc('ct'))
.columnArray('industry')
},
color: {
range: ["#31739C", "#E85E26"]
},
marks: [
Plot.barX(
exch
.groupby('industry', 'supported')
.rollup({ct: d => op.sum(d.n)})
.orderby(aq.desc('supported')),
{
x: "ct",
y: "industry",
fill: "supported"
}
)
]
})
Insert cell
Insert cell
Insert cell
exch_by_year = exch
.derive({
year: (d) => op.year(d.rls_date) * 1
})
.groupby("industry", "supported", "year")
.rollup({ ct: (d) => op.sum(d.n) })
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
aq.addFunction("year", d3.timeFormat("%Y"), { override: true })
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