Skip to content

Instantly share code, notes, and snippets.

@Pome-ro
Created November 8, 2017 16:06
Show Gist options
  • Save Pome-ro/a58ead3f5bc500bbfb9f8af79d4c80cb to your computer and use it in GitHub Desktop.
Save Pome-ro/a58ead3f5bc500bbfb9f8af79d4c80cb to your computer and use it in GitHub Desktop.
if ($i -eq $null) {$i = 8080}
$i++
$Colors = @{
BackgroundColor = "#12A5EC"
FontColor = "#FFFFFFFF"
}
$Data = @();
$Data += [PSCustomObject]@{"DataName" = "DataSet 1"; "Dogs" = 54; "Cats" = 23; "Birds" = 12}
$Data += [PSCustomObject]@{"DataName" = "DataSet 2"; "Dogs" = 21; "Cats" = 34; "Birds" = 52}
$Data += [PSCustomObject]@{"DataName" = "DataSet 3"; "Dogs" = 15; "Cats" = 22; "Birds" = 88}
$Data += [PSCustomObject]@{"DataName" = "DataSet 4"; "Dogs" = 11; "Cats" = 44; "Birds" = 36}
Start-UDDashboard -port $i -Content {
New-UDDashboard -NavbarLinks $NavBarLinks -Title "For Loop Example" -NavBarColor '#011721' -NavBarFontColor "#CCEDFD" -BackgroundColor "#66C7F6" -FontColor "#011721" -Content {
New-UDRow {
foreach ($Dataset in $Data) {
New-UDColumn -Size 3 {
New-UDChart -Title $Dataset.Dataname -type Bar @Colors -Endpoint {
$DataSet | Out-UDChartData -Verbose -LabelProperty "DataName" -Dataset @(
New-UDChartDataset -DataProperty "Dogs" -Label "Dogs" -BackgroundColor "#080e1c" -HoverBackgroundColor "#080e1c"
New-UDChartDataset -DataProperty "Cats" -Label "Cats" -BackgroundColor "#42d4f4" -HoverBackgroundColor "#42d4f4"
New-UDChartDataset -DataProperty "Birds" -Label "Birds" -BackgroundColor "#ce3ef2" -HoverBackgroundColor "#ce3ef2"
)
}
}
}
}
}
}
Start-Process http://localhost:$i
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment