Published
Edited
Oct 7, 2021
1 fork
2 stars
Insert cell
Insert cell
Insert cell
apiLogData = FileAttachment("apiLogData.json").json()
Insert cell
Inputs.table(apiLogData)
Insert cell
Insert cell
Insert cell
// TODO your code here
Insert cell
Insert cell
Insert cell
viewof favColors = Inputs.checkbox(
["red", "orange", "yellow", "green", "blue", "purple"],
{ label: "Colors I like:" }
)
Insert cell
Insert cell
favColors
Insert cell
Insert cell
favColors.map((s) => s.toUpperCase())
Insert cell
`I like the colors ${favColors.join(", ")}`
Insert cell
Insert cell
viewof selectedCodes = Inputs.checkbox(
[], // TODO replace this
{} // TODO optionally set options here
)
Insert cell
selectedCodes
Insert cell
statusCodes = Array.from(new Set(apiLogData.map((d) => d.status_code))).sort()
Insert cell
Insert cell
Insert cell
// TODO copy your plot code here
// then update it to only plot responses with the selected status codes
Insert cell
Insert cell
Insert cell
viewof pathSearch = Inputs.search(
[] // TODO replace this
)
Insert cell
// TODO paste & update your plot here to connect it to the pathSearch filtered data array
Insert cell
Insert cell
Insert cell
viewof finishedSelectedCodes = Inputs.checkbox(statusCodes, {
value: statusCodes
})
Insert cell
viewof finishedPathSearch = Inputs.search(apiLogData)
Insert cell
// One possible solution; yours may differ!
finishedResponses = Plot.dot(
finishedPathSearch.filter((d) =>
finishedSelectedCodes.includes(d.status_code)
),
{
x: "timestamp",
y: "duration",
fill: "path",
fillOpacity: 0.5,
title: (d) =>
[d.path, `${d.duration} ms`, `status ${d.status_code}`].join("\n")
}
).plot({
width,
x: { axis: null },
marginLeft: 50
})
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