Simple 2-D or 3-D object to pie chart

Never mind - I figured out that I should make a hash table and pass that to out-UDChartData instead of my object. (the hint was here: How to create consistent pie chart labels and colors).

New-UDChart -Title "Whats Up-Down" -type pie -AutoRefresh -RefreshInterval 60 -Endpoint {
            $UpDown = [ordered]@{Up = ($WhatsUpDown | Where-Object {$_.isOn -eq $true}).count;Down = $($WhatsUpDown | Where-Object {$_.isOn -eq $false}).count} #Works
            $UpDown | Out-UDChartData -DataProperty "Values" `
            -BackgroundColor @("green", "red") `
            -LabelProperty "Keys" `
            -HoverBackgroundColor "orange"}

Hope this helps someone else.

1 Like