Skip to content

Bars

-Type bar with one or more -Y columns or -GroupBy for one series per group. -Stacked stacks the series, -Normalize stacks them to 100 %, -Horizontal turns the bars, -DataLabels writes the values on them, -NegativeColor colours negative values. A bar chart can switch to lines or stacks from its toolbox.

Horizontal and sorted

Sort in PowerShell; -Horizontal turns the bars.

$vms = 'Windows Server 2025', 'Windows Server 2022', 'Ubuntu 24.04', 'RHEL 9', 'Debian 12', 'SLES 15' | ForEach-Object -Begin { $n = 0 } -Process { $n++; [pscustomobject]@{ OS = $_; VMs = 40 * $n + 3 * $_.Length } }
New-UDEChart -Data ($vms | Sort-Object VMs) -Type bar -Horizontal -X OS -Y VMs -DataLabels -Height 320px

Shares of 100 % per category

-Normalize stacks to 100 %; the tooltip shows share and original value.

$mix = foreach ($q in 'Q1', 'Q2', 'Q3', 'Q4') {
    [pscustomobject]@{ Quarter = $q; Mail = 120 - 10 * $q[1]; Phone = 80; Portal = 60 + 25 * [int]"$($q[1])" }
}
New-UDEChart -Data $mix -Type bar -X Quarter -Y Mail, Phone, Portal -Normalize -DataLabels -Height 320px

Negative values

-NegativeColor marks losses.

$result = 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun' | ForEach-Object -Begin { $i = 0 } -Process { $i++; [pscustomobject]@{ Month = $_; Result = [math]::Round(40 * [math]::Sin($i)) } }
New-UDEChart -Data $result -Type bar -X Month -Y Result -NegativeColor '#e53935' -Format 'currency:EUR' -Height 300px