Public
Edited
May 30, 2023
36 forks
Importers
32 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
tasks = [
{
task: "Develop survey",
group: "Data team",
startDate: "2023-04-01",
endDate: "2023-07-01",
description:
"Team will work with HR to develop a user survey about product usage and perception."
},
{
task: "Distributing surveys",
group: "Marketing",
startDate: "2023-07-03",
endDate: "2023-07-10",
description:
"Mail, email, and post surveys on socials."
},
{
task: "Collect responses",
group: "Data team",
startDate: "2023-10-01",
endDate: "2024-04-31",
description: "Collect survey responses and send reminders."
},
{
task: "Content creation",
group: "Marketing",
startDate: "2024-01-01",
endDate: "2024-08-10",
description: "Create brochures, ads and web assets to share with users."
},
{
task: "Feedback and interviews",
group: "Customer success",
startDate: "2024-04-18",
endDate: "2024-09-11",
description: "Analyze data and share with board."
}
]
Insert cell
Insert cell
Insert cell
myColors = [{group: "Marketing", color: "gold"},
{group: "Data team", color: "#56B4e9"},
{group: "Customer success", color: "tomato"}]
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Plot.plot({
marks: [
Plot.frame({ stroke: settings.panelBorder == "show" ? "#ccc" : null }),
Plot.barX(tasks, {
y: "task",
x1: (d) => parser(d.startDate),
x2: (d) => parser(d.endDate),
fill: "group",
rx: settings.barRoundness,
insetTop: settings.barHeight,
insetBottom: settings.barHeight
}),
Plot.text(tasks, {
y: "task",
x: (d) => parser(d.startDate),
text: (d) => d.task,
textAnchor: "start",
dy: settings.textPosition,
fontSize: settings.fontSize,
stroke: "white",
fill: "dimgray",
fontWeight: 500
}),
Plot.tip(tasks, Plot.pointerY({
y: "task",
x1: (d) => parser(d.startDate),
x2: (d) => parser(d.endDate),
title: (d) =>
`Team: ${d.group}\nTask: ${d.task}\nDescription: ${d.description}\nStart: ${d.startDate}\nEnd: ${d.endDate}`
}))
],
height: settings.plotHeight,
width: settings.plotWidth,
x: { grid: (settings.gridlines == "x") | (settings.gridlines == "both") ? true : null },
y: {
domain: domainByDate,
label: null,
tickFormat: null,
tickSize: null,
grid: (settings.gridlines == "y") | (settings.gridlines == "both") ? true : null
},
color: { domain: domainByGroup, range: colors, legend: true }
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
domainByDate = tasks.sort((a, b) => d3.ascending(a.startDate, b.startDate)).map(d => d.task)
Insert cell
Insert cell
domainByGroup = d3.groups(tasks, d => d.group).sort((a, b) => d3.ascending(a.startDate, b.startDate)).map(d => d[0])
Insert cell
Insert cell
parser = d3.utcParse("%Y-%m-%d")
Insert cell
Insert cell
colorMap = new Map(myColors.map((obj) => [obj.group, obj.color]))
Insert cell
colors = domainByGroup.map(d => colorMap.get(d))
Insert cell
Insert cell
import {getIcon} from '@observablehq/product-education-icon-helpers'
Insert cell
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more