mirror of
https://github.com/umami-software/umami.git
synced 2026-02-10 07:37:11 +01:00
Merge branch 'dev' into unknown-count
This commit is contained in:
commit
490fc99a8a
41 changed files with 615 additions and 379 deletions
|
|
@ -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 }));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue