change to object destructuring for drawGraph() arguments

hugo
DhammaCharts 3 years ago
parent d261655d96
commit c88f31c364

@ -1,16 +1,15 @@
async function drawGraph( async function drawGraph(baseUrl,isHome,pathColors,graphConfig) {
baseUrl,
pathColors, let {
depth, depth,
enableDrag, enableDrag,
enableLegend, enableLegend,
enableZoom, enableZoom,
isHome,
opacityScale, opacityScale,
scale, scale,
repelForce, repelForce,
fontSize fontSize} = graphConfig;
) {
const container = document.getElementById("graph-container") const container = document.getElementById("graph-container")
const { index, links, content } = await fetchData const { index, links, content } = await fetchData

@ -5,31 +5,33 @@ enableGlobalGraph: true
### Local Graph ### ### Local Graph ###
enableLegend: false localGraph:
enableDrag: true enableLegend: false
enableZoom: true enableDrag: true
depth: 1 # set to -1 to show full graph enableZoom: true
scale: 1.2 depth: 1 # set to -1 to show full graph
repelForce: 2 scale: 1.2
centerForce: 1 repelForce: 2
linkDistance: 1 centerForce: 1
fontSize: 0.6 linkDistance: 1
opacityScale: 3 fontSize: 0.6
opacityScale: 3
### Global Graph ### ### Global Graph ###
enableLegendGG: false globalGraph:
enableDragGG: true enableLegend: false
enableZoomGG: true enableDrag: true
depthGG: -1 # set to -1 to show full graph enableZoom: true
scaleGG: 1.4 depth: -1 # set to -1 to show full graph
repelForceGG: 1 scale: 1.4
centerForceGG: 1 repelForce: 1
linkDistanceGG: 1 centerForce: 1
fontSizeGG: 0.5 linkDistance: 1
opacityScaleGG: 3 fontSize: 0.5
opacityScale: 3
### Graphs ### ### For all graphs ###
paths: paths:
- /moc: "#4388cc" - /moc: "#4388cc"

@ -79,30 +79,16 @@
if (isHome && {{$.Site.Data.graphConfig.enableGlobalGraph}}) { if (isHome && {{$.Site.Data.graphConfig.enableGlobalGraph}}) {
drawGraph( drawGraph(
{{strings.TrimRight "/" .Site.BaseURL}}, {{strings.TrimRight "/" .Site.BaseURL}},
{{$.Site.Data.graphConfig.paths}},
{{$.Site.Data.graphConfig.depthGG}},
{{$.Site.Data.graphConfig.enableDragGG}},
{{$.Site.Data.graphConfig.enableLegendGG}},
{{$.Site.Data.graphConfig.enableZoomGG}},
true, true,
{{$.Site.Data.graphConfig.opacityScaleGG}}, {{$.Site.Data.graphConfig.paths}},
{{$.Site.Data.graphConfig.scaleGG}}, {{$.Site.Data.graphConfig.globalGraph}}
{{$.Site.Data.graphConfig.repelForceGG}},
{{$.Site.Data.graphConfig.fontSizeGG}}
); );
} else { } else {
drawGraph( drawGraph(
{{strings.TrimRight "/" .Site.BaseURL}}, {{strings.TrimRight "/" .Site.BaseURL}},
{{$.Site.Data.graphConfig.paths}},
{{$.Site.Data.graphConfig.depth}},
{{$.Site.Data.graphConfig.enableDrag}},
{{$.Site.Data.graphConfig.enableLegend}},
{{$.Site.Data.graphConfig.enableZoom}},
false, false,
{{$.Site.Data.graphConfig.opacityScale}}, {{$.Site.Data.graphConfig.paths}},
{{$.Site.Data.graphConfig.scale}}, {{$.Site.Data.graphConfig.localGraph}}
{{$.Site.Data.graphConfig.repelForce}},
{{$.Site.Data.graphConfig.fontSize}}
); );
} }

Loading…
Cancel
Save