From c89de64dc57b2f17ce3a5270d1a866b6395cf34b Mon Sep 17 00:00:00 2001 From: Ross Keenan Date: Mon, 2 Aug 2021 12:24:22 +0200 Subject: [PATCH] feat(Stats View): :sparkles: Node, Real Edge, Implied Edge counts --- src/Components/Stats.svelte | 94 +++++++++++++++++++++++++++++++++++++ src/StatsView.ts | 7 +-- src/sharedFunctions.ts | 4 ++ 3 files changed, 100 insertions(+), 5 deletions(-) diff --git a/src/Components/Stats.svelte b/src/Components/Stats.svelte index e69de29b..b7a0fb20 100644 --- a/src/Components/Stats.svelte +++ b/src/Components/Stats.svelte @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MeasureParentSiblingChildTotal
Nodes{pRNodes.length}{sRNodes.length}{cRNodes.length}{pRNodes.length + sRNodes.length + cRNodes.length}
Real Edges `${e.v} → ${e.w}`).join("\n")} + >{pREdges.length} `${e.v} → ${e.w}`).join("\n")} + >{sREdges.length} `${e.v} → ${e.w}`).join("\n")} + >{cREdges.length}{pREdges.length + sREdges.length + cREdges.length}
Implied Edges `${e.v} → ${e.w}`), + pREdges.map((e) => `${e.v} → ${e.w}`) + ).join("\n")}>{pAEdges.length - pREdges.length} `${e.v} → ${e.w}`), + sREdges.map((e) => `${e.v} → ${e.w}`) + ).join("\n")}>{sAEdges.length - sREdges.length} `${e.v} → ${e.w}`), + cREdges.map((e) => `${e.v} → ${e.w}`) + ).join("\n")}>{cAEdges.length - cREdges.length}{pREdges.length + sREdges.length + cREdges.length}
+ + diff --git a/src/StatsView.ts b/src/StatsView.ts index 244d2065..b0ada018 100644 --- a/src/StatsView.ts +++ b/src/StatsView.ts @@ -31,7 +31,7 @@ export default class StatsView extends ItemView { return "Breadcrumbs Stats"; } - icon = "bullet-list-glyph"; + icon = "info"; async onOpen(): Promise { await this.plugin.saveSettings(); @@ -74,13 +74,10 @@ export default class StatsView extends ItemView { async draw(): Promise { this.contentEl.empty(); - // const { gParents, gSiblings, gChildren } = this.plugin.currGraphs; - // const currFile = this.app.workspace.getActiveFile(); - // const settings = this.plugin.settings; this.view = new Stats({ target: this.contentEl, - props: {}, + props: { plugin: this.plugin }, }); } } diff --git a/src/sharedFunctions.ts b/src/sharedFunctions.ts index 93156a01..9b2c3243 100644 --- a/src/sharedFunctions.ts +++ b/src/sharedFunctions.ts @@ -397,3 +397,7 @@ export function dropMD(path: string) { } export const range = (n: number) => [...Array(5).keys()]; + +export function complement(A: T[], B: T[]) { + return A.filter((a) => !B.includes(a)); +}