Published
Edited
Dec 27, 2020
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
authData = login({ email, password })
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
loadEvents = graph(`query ProjectEventsQuery($projectId: ID!, $skip: Int!) {
project(id: $projectId) {
id
name
events(skip: $skip) {
id
payload {
type
timestamp
user {
id
}
title
context
addons
}
repetitions {
id
payload {
context
addons
}
}
}
}
}`)
Insert cell
events = {
const events = [];
let skip = 0;

while (skip <= 100) {
const newEventsData = await loadEvents({
projectId: selectedProjectId,
skip
});
console.log(newEventsData);
const newEvents = newEventsData.project.events;

newEvents.forEach(val => {
const { repetitions, ...event } = val;
skip += 1;
events.push(event);
const mergedRepetitions = repetitions.map(rep => ({
...rep,
payload: deepMerge(event.payload, deepMerge.payload)
}));
events.push(...mergedRepetitions);
});

if (!newEvents || !newEvents.length) {
break;
}
}
return events;
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
parsedUserAgents = userAgents.map(agent => uaParser(agent))
Insert cell
Insert cell
Insert cell
osDistribution = Array.from(
d3.group(parsedUserAgents, agent => agent.os.name),
([name, value]) => ({ name, value: value.length })
)
Insert cell
osPieChart
Insert cell
Insert cell
browsersPieChart
Insert cell
browsersDistribution = Array.from(
d3.group(parsedUserAgents, agent => agent.browser.name),
([name, value]) => ({ name, value: value.length })
)
Insert cell
Insert cell
windowSizes = events.map(event => event.payload.addons?.window || 'undefined')
Insert cell
groupedWindowSizes = d3.group(
windowSizes,
d => `${d.innerWidth}×${d.innerHeight}`
)
Insert cell
Insert cell
Insert cell
agentsTreeChart
Insert cell
md`## Analize error types`
Insert cell
errorTypesDistibution = Array.from(
d3.group(events.map(event => event.payload.type), d => d),
([name, value]) => ({ name: String(name), value: value.length })
)
Insert cell
chart
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
import { chart as browsersPieChart } with {
browsersDistribution as data
} from '@d3/pie-chart'
Insert cell
import { chart as agentsTreeChart } with {
treeMapData as data
} from '@d3/treemap'
Insert cell
import { chart } with { errorTypesDistibution as data } from '@d3/bar-chart'
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
_ = require('lodash')
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