Merge branch 'dev' into unknown-count

This commit is contained in:
Mike Cao authored and GitHub committed 2021-02-20 02:00:49 -08:00
commit 490fc99a8a
41 files changed
+615 -379

No files matched your search

+11
View File
@@ -115,6 +115,17 @@ export const refFilter = (data, { domain, domainOnly, raw }) => {
export const browserFilter = data => data.map(({ x, y }) => ({ x: BROWSERS[x] ?? x, y }));
export const eventTypeFilter = (data, types) => {
if (!types || types.length === 0) {
return data;
}
return data.filter(({ x }) => {
const [event] = x.split('\t');
return types.some(type => type === event);
});
};
export const percentFilter = data => {
const total = data.reduce((n, { y }) => n + y, 0);
return data.map(({ x, y, ...props }) => ({ x, y, z: total ? (y / total) * 100 : 0, ...props }));