Show all labels in chart?

Looking for some input on if it’s possible to force a chart to include all of the labels for its data. Below is a sample chart I was working on:

As you can see, there are only labels for a few of the column pairs, I’d like to find a way to display the name of each pair of columns. The code is below

    New-UDLayout -Columns 2 -Content {
        New-UdChart -Title "CPU Total vs Usage per Host" -Type Bar -Endpoint {
             $VMWareHostData | ForEach-Object {
            [PSCustomObject]@{ Name = $_.host_name;
                "CPU Total" = $_.cpu_total;
                "CPU Usage" = $_.cpu_usage; } } | Out-UDChartData -LabelProperty "Name" -Dataset @(
            New-UdChartDataset -DataProperty "CPU Total" -Label "CPU Total" -BackgroundColor "#80962F23" -HoverBackgroundColor "#80962F23"
            New-UdChartDataset -DataProperty "CPU Usage" -Label "CPU Used" -BackgroundColor "#8014558C" -HoverBackgroundColor "#8014558C"
            )
        }
        New-UdChart -Title "Memory Total vs Usage per Host" -Type Bar -Endpoint {
            $VMWareHostData | ForEach-Object {
            [PSCustomObject]@{ Name = $_.host_name;
                "Memory Total" = $_.mem_totalgb;
                "Memory Usage" = $_.mem_usagegb; } } | Out-UDChartData -LabelProperty "Name" -Dataset @(
            New-UdChartDataset -DataProperty "Memory Total" -Label "Memory Total" -BackgroundColor "#80962F23" -HoverBackgroundColor "#80962F23"
            New-UdChartDataset -DataProperty "Memory Usage" -Label "Memory Usage" -BackgroundColor "#8014558C" -HoverBackgroundColor "#8014558C"
            )
        }
    }

I see there are some flags which might be of use (-AdditionalOptions) but have no idea what is available to that flag and I haven’t seen anything else which would tell the chart to include all of the hosts along the bottom of the chart.

Any advice would be greatly appreciated!

Lowering the fontsize might work, it can be done using the -Options parameter, with reference to this:
https://www.chartjs.org/docs/latest/axes/styling.html

I’ve been using the -options parameter to hide all labels like explained here:

Something like this might work, though I haven’t tested it.

-Options @{
    scales = @{  
        xAxes = @(
            Ticks = @{
               fontSize = '8'
               }
        )
    }
 }
1 Like

Following worked for me. Leaving this here because it took a bit of mangling to get this to work.

 New-UDChart -Type Bar -Endpoint {
                        $Bldg_Versions_Count | Where-Object {$_.Version -eq $Session:W10ChartVer} | Select building, count | Out-UDChartData -DataProperty count -DataSetLabel "Ver: $Session:W10ChartVer" -LabelProperty building
                        

                    } -Options @{
                    scales = @{
                        xAxes = @(
                            @{
                            ticks = @{
                                autoSkip = $false
                                }
                            }    
                        )
                    }
                    legend = @{
                        display = $false
                    }
                
                }
2 Likes