New-UDChart - Pie chart ratios appear wrong

Here’s my code for collecting total and free diskspace

New-UDColumn -Size 4 -Content {
        New-UDChart -Title (Invoke-RestMethod -headers $session -method GET -uri "https://cd-lab-vc1.cragdoo.co.uk/rest/vcenter/datastore/datastore-327").value.name -Type Pie -AutoRefresh -RefreshInterval 60 -BackgroundColor $BackgroundColor -FontColor $FontColor  -Endpoint {
            $Repo = @();
            $Repo += [PSCustomObject] @{ "Space" = "Capacity GB"; "Count" = [Math]::round((((Invoke-RestMethod -headers $session -method GET -uri "https://cd-lab-vc1.cragdoo.co.uk/rest/vcenter/datastore?filter.datastores=datastore-327").value.Capacity) / 1073741824), 0)}
            $Repo += [PSCustomObject] @{ "Space" = "Free GB"; "Count" = [Math]::round((((Invoke-RestMethod -headers $session -method GET -uri "https://cd-lab-vc1.cragdoo.co.uk/rest//vcenter/datastore?filter.datastores=datastore-327").value.free_space) / 1073741824), 0)}
            $Repo | Out-UDChartData -LabelProperty Space -Dataset @(New-UDChartDataset -DataProperty "Count" -Label "GB" -BackgroundColor @("#24ad1d", "#4085ed") -HoverBackgroundColor @("#24ad1d", "#4085ed"))
        } -Options @{cutoutPercentage = 0}
    }

and the figures returned are
Total : 492
Free : 480

and the chart does draw, but the ratio looks wrong. I’d expect the Blue ‘free’ value to be much bigger. Or am I missing something about the pie charts etc

pie

I think you want to use Free and Used rather than Free and Total.

I would subtract the free from the total and then put the Free and Used space in the pie graph and I think you’ll get the effect you are looking for.