Published
Edited
Jan 21, 2022
Insert cell
Insert cell
Insert cell
Insert cell
Plot.plot({
x: {
grid: true
},
/* color: {
domain: ['ctr-fns01'],
range: ['red']
}, */
y: {
grid: true,
label: "connected probe change"
},
marks: [
Plot.line( ctrl_timeline, {x: "ts", y: "relprbcnt", z: "controller", stroke: "controller", opacity: 0.5} ),
Plot.ruleY([0])
]
});
Insert cell
ctrl_timeline = { // test if this works (might be faster to fetch all and then filter?)
let promise = fetch(
`https://atlas.ripe.net:443/api/v2/measurements/7000/results/?start=${_start.toISOString()}&stop=${_stop.toISOString()}`
).then(r => r.json())
let j = await promise
let ctrl_state = {} // controller counts
/* let prb_state = {} // probe state
let prb_updown = [] */ // could produce prb graphs via this as well!
let ctrl_timeline = [] // timeline, relative to the start
j.forEach( ev => {
if (! ctrl_state.hasOwnProperty( ev.controller ) ) {
ctrl_state[ ev.controller ] = 0
}
if (ev.event == 'disconnect') {
ctrl_state[ ev.controller ] -= 1
} else if ( ev.event == 'connect') {
ctrl_state[ ev.controller ] += 1
}
ctrl_timeline.push({
'controller': ev.controller,
'ts': new Date( ev.timestamp * 1000 ), /// how to deal with multiple events within same second?
'relprbcnt': ctrl_state[ ev.controller ]
})
})
ctrl_timeline.sort( (a,b) => { a.controller <= b.controller } )
return ctrl_timeline
}
Insert cell
import {bind} from "@observablehq/inputs"
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