diff --git a/src/Visualisations/ForceDirectedG.ts b/src/Visualisations/ForceDirectedG.ts index c27ab048..5c705ec0 100644 --- a/src/Visualisations/ForceDirectedG.ts +++ b/src/Visualisations/ForceDirectedG.ts @@ -61,7 +61,7 @@ export const forceDirectedG = ( "link", d3.forceLink(links).id((d) => d.id) ) - .force("charge", d3.forceManyBody().strength(-6)) + .force("charge", d3.forceManyBody().strength(-8)) .force("center", d3.forceCenter(width / 2, height / 2).strength(0.5)); const drag = (simulation: d3.Simulation) => { diff --git a/src/sharedFunctions.ts b/src/sharedFunctions.ts index 010d754d..9db1b183 100644 --- a/src/sharedFunctions.ts +++ b/src/sharedFunctions.ts @@ -200,32 +200,47 @@ export function getFieldValues( ) { const values: string[] = []; try { - const rawValues: (string | number | dvLink | Pos | TFile | undefined)[] = [ - frontmatterCache?.[field], - ].flat(4); - - superDebug(settings, `${field} of: ${frontmatterCache?.file?.path}`); - superDebug(settings, { rawValues }); - - rawValues.forEach((rawItem) => { - if (!rawItem) return; - if (typeof rawItem === "string" || typeof rawItem === "number") { - // Obs cache converts link of form: [[\d+]] to number[][] - const rawItemAsString = rawItem.toString(); - const splits = rawItemAsString.match(splitLinksRegex); - if (splits !== null) { - const strs = splits - .map((link) => link.match(dropHeaderOrAlias)[1]) - .map((str: string) => str.split("/").last()); - } else { - values.push(rawItemAsString.split("/").last()); - } - } else if (rawItem.path) { - values.push((rawItem as dvLink).path.split("/").last()); + const rawValuesPreFlat = frontmatterCache?.[field]; + if (typeof rawValuesPreFlat === "string") { + const splits = rawValuesPreFlat.match(splitLinksRegex); + if (splits !== null) { + const strs = splits.map((link) => + link.match(dropHeaderOrAlias)[1].split("/").last() + ); + values.push(...strs); } - }); + // else { + // Dont't add anything, it's not a link + // } + } else { + const rawValues: (string | number | dvLink | Pos | TFile | undefined)[] = + [rawValuesPreFlat].flat(4); + + superDebug(settings, `${field} of: ${frontmatterCache?.file?.path}`); + superDebug(settings, { rawValues }); + + rawValues.forEach((rawItem) => { + if (!rawItem) return; + if (typeof rawItem === "string" || typeof rawItem === "number") { + // Obs cache converts link of form: [[\d+]] to number[][] + const rawItemAsString = rawItem.toString(); + const splits = rawItemAsString.match(splitLinksRegex); + if (splits !== null) { + const strs = splits.map((link) => + link.match(dropHeaderOrAlias)[1].split("/").last() + ); + values.push(...strs); + } else { + values.push(rawItemAsString.split("/").last()); + } + } else if (rawItem.path) { + values.push((rawItem as dvLink).path.split("/").last()); + } + }); + } return values; } catch (error) { + console.log(error); return values; } }