Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion Public/New-HTMLHierarchicalTree.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
function New-HTMLHierarchicalTree {
[cmdletBinding()]
param(
[ScriptBlock] $TreeView
[ScriptBlock] $TreeView,
[Switch]$Autosize
)
$Script:HTMLSchema.Features.MainFlex = $true
$Script:HTMLSchema.Features.D3Mitch = $true
Expand All @@ -20,6 +21,13 @@
# Prepare NODES
$Data = $TreeNodes | ConvertTo-Json -Depth 5

# Set sizing mode
if ($Autosize) {
$SizingMode = 'nodeSize' # Size the SVG based on the nodes
} else {
$SizingMode = 'size' # Use configured height/width for the SVG
}

# Prepare HTML
$Section = New-HTMLTag -Tag 'section' -Attributes @{ id = $ID; class = 'hierarchicalTree' }
$Script = New-HTMLTag -Tag 'script' -Value { @"
Expand All @@ -40,6 +48,9 @@
.setTitleDisplayTextAccessor(function (data) {
return data.name;
})
.getNodeSettings()
.setSizingMode('${SizingMode}')
.back()
.initialize();
"@
} -NewLine
Expand Down