Hello,
Can I define consistency with chart label names and color?
Below are 3 identical charts, only the source data has been changed to vary the status. Here are my observations:
- Chart labels appear in the same order as the csv source file
- Colors are applied in the order specified in New-UDChart
- Label names only appear if they exist in the source data
- Can I map colors to a specific status? Success = green, Warning = yellow, Running = blue, Failed = red
- Can I display all 4 names in order, even if there is no data to display?
Here is my code:
$theme = Get-UDTheme -Name âAzureâ
$xmlData = Import-Csv -Path C:\Data\BackupExport.csv
$xmlData2 = Import-Csv -Path C:\Data\BackupExport2.csv
$xmlData3 = Import-Csv -Path C:\Data\BackupExport3.csv$MyDashboard = New-UDDashboard -Title âBackup Job Dashboardâ -Theme $theme -Content {
New-UDRow -Columns {
New-UDColumn -Size 3 {
New-UDChart -Title âStatus 1â -Type Pie -FontColor â#ffdc00â -Endpoint {
$xmlData.Status |
Group-Object |
Select-Object Name, Count |
Out-UdChartData -DataProperty âcountâ-BackgroundColor @("red", "blue", "green", "yellow")
-BorderColor @(âblackâ, âblackâ, âblackâ, âblackâ)-LabelProperty "Name"
-HoverBackgroundColor âyellowâ
} -Options @{
legend = @{
display = $true;
position = ârightâ
labels = @{
fontColor = â#FFFFFFâ;
fontSize = 16
}
}
}
}New-UDColumn -Size 3 { New-UDChart -Title "Status 2" -Type Pie -FontColor "#ffdc00" -Endpoint { $xmlData2.Status | Group-Object | Select-Object Name, Count | Out-UdChartData -DataProperty "count" ` -BackgroundColor @("red", "blue", "green", "yellow") ` -BorderColor @("black", "black", "black", "black") ` -LabelProperty "Name" ` -HoverBackgroundColor "yellow" } -Options @{ legend = @{ display = $true; position = 'right' labels = @{ fontColor = '#FFFFFF'; fontSize = 16 } } } } New-UDColumn -Size 3 { New-UDChart -Title "Status 3" -Type Pie -FontColor "#ffdc00" -Endpoint { $xmlData3.Status | Group-Object | Select-Object Name, Count | Out-UdChartData -DataProperty "count" ` -BackgroundColor @("red", "blue", "green", "yellow") ` -BorderColor @("black", "black", "black", "black") ` -LabelProperty "Name" ` -HoverBackgroundColor "yellow" } -Options @{ legend = @{ display = $true; position = 'right' labels = @{ fontColor = '#FFFFFF'; fontSize = 16 } } } } }
}
Start-UDDashboard -Port 1001 -Dashboard $MyDashboard
Regards,
Mark Tellier