src/UtilityFunctions.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Function CenterAlignString ($String, $Length) {
        $Padding = [math]::Round( $Length/2 + [math]::round( $String.length/2)  )
        return $String.PadLeft($Padding)
}
Function CenterAlignStringReturnIndices ($String, $Length) {
        $StartIdx = [Math]::Round(($Length + ($String.Length -1)) / 2 )
        $EndIdx = $StartIdx - ($String.Length -1)
        return $StartIdx, $EndIdx
}

Function Write-Graph($YAxisLabelAlphabet, $YAxisLabel, $Row, $RowColor, $LabelColor)
{
    Write-Host $([char]9474) -NoNewline
    Write-Host $YAxisLabelAlphabet -ForegroundColor $LabelColor -NoNewline
    Write-Host "$($YAxisLabel.tostring().PadLeft($LengthOfMaxYAxisLabel+2) + [Char]9508)" -NoNewline
    ##Write-Host "$YAxisLabel|" -NoNewline
    Write-Host $Row -ForegroundColor $RowColor -NoNewline
    Write-Host " " $([char]9474) 
}