Scripts/New-UDTimeLineData.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<#
.SYNOPSIS
    Sample control for UniversalDashboard.
.DESCRIPTION
    Sample control function for UniversalDashboard. This function must have an ID and return a hash table.
.PARAMETER Id
    An id for the component default value will be generated by new-guid.
.EXAMPLE
    PS C:\> <example usage>
    Explanation of what the example does
.INPUTS
    Inputs (if any)
.OUTPUTS
    Output (if any)
.NOTES
    General notes
#>

function New-UDTimeLineData {
    param(
        [Parameter(Mandatory = $true)]
        [string]$RowLabel,

        [Parameter(Mandatory = $false)]
        $BarLabel = "",

        [Parameter(Mandatory = $false)]
        $tooltip = $null,

        [Parameter(Mandatory = $true)]
        [DateTime]$Start,

        [Parameter(Mandatory = $true)]
        [DateTime]$End,

        [Parameter(Mandatory = $false)]
        $Color
    )

    End {
        [PSCustomObject]@{
            RowLabel = $RowLabel
            BarLabel = $BarLabel
            tooltip  = $tooltip
            Start    = "Date($($Start.Year), $($Start.Month - 1), $($Start.Day), $($Start.Hour), $($Start.Minute), $($Start.Second), $($Start.Millisecond))"
            End      = "Date($($End.Year), $($End.Month - 1), $($End.Day), $($End.Hour), $($End.Minute), $($End.Second), $($End.Millisecond))"
            Color    = $Color
        }

    }
}