New-UDChartJS Pie\Doughnut

Product: PowerShell Universal
Version: 3.9.1

I know I am probably missing something easy here but I am having trouble building a chart for used space and free space. My dataset is basically just free space and used space. Trying to do something like this.

ULuqhH5H4o

Here’s an example that does this with disk drives.

Thanks that did it for me. My only problem now is it doesn’t show the label names on the legend.

If you can share your code, I can try and figure it out.

Here is my code and what is displayed. Thanks!

image

New-UDCard -Id 'Cloudian' -Content {
                $MonitorResponse = Invoke-RestMethod @Params
                $data = @(
                    @{ Label = 'Used'; Value = $MonitorResponse.diskUsedKb.value }
                    @{ Label = 'Free'; Value = $MonitorResponse.diskAvailKb.value}
                )
        New-UDGrid -Container -Children {
            New-UDGrid -Item -Children {
                New-UDTypography -Text "Cloudian"
            } -ExtraSmallSize 12
            New-UDGrid -Item -Children {
                New-UDChartJS -Type doughnut -Data $data -LabelProperty 'Label' -DataProperty 'value' -BackgroundColor @('#126f8c', '#8da322')
            }
        }

I found my issue, I have a custom theme and the text is the same color as the background.

Thanks for your help.

How can I change the size of the chart?

Charts and cards will fill the space that contain them, take a look on Grid - PowerShell Universal

Thanks for the reply, I am using grids but the chart doesn’t resize. I am actually using new-udgridlayout as well.