diff --git a/src/Show-Graph.ps1 b/src/Show-Graph.ps1 index 5948584..5aade83 100644 --- a/src/Show-Graph.ps1 +++ b/src/Show-Graph.ps1 @@ -141,8 +141,8 @@ Function Show-Graph { $BottomBoundaryLength = $XAxis.Length + 2 # draw top boundary - [string]::Concat($TopLeft," ",$GraphTitle," ",$([string]$TopEdge * $TopBoundaryLength),$TopRight) - [String]::Concat($VerticalEdge,$(" "*$($XAxis.length+2)),$VerticalEdge) # extra line to add space between top-boundary and the graph + Write-Host ([string]::Concat($TopLeft," ",$GraphTitle," ",$([string]$TopEdge * $TopBoundaryLength),$TopRight)) + Write-Host ([String]::Concat($VerticalEdge,$(" "*$($XAxis.length+2)),$VerticalEdge)) # extra line to add space between top-boundary and the graph # draw the graph For($i=$NumOfRows;$i -gt 0;$i--){ @@ -231,8 +231,8 @@ Function Show-Graph { # draw bottom boundary $XAxisLabel +=" "*($XAxis.Length-$XAxisLabel.Length) # to match x-axis label length with x-axis length - [String]::Concat($VerticalEdge,$XAxis," ",$VerticalEdge) # Prints X-Axis horizontal line - [string]::Concat($VerticalEdge,$XAxisLabel," ",$VerticalEdge) # Prints X-Axis step labels + Write-Host([String]::Concat($VerticalEdge,$XAxis," ",$VerticalEdge)) # Prints X-Axis horizontal line + Write-Host([string]::Concat($VerticalEdge,$XAxisLabel," ",$VerticalEdge)) # Prints X-Axis step labels if(![String]::IsNullOrWhiteSpace($XAxisTitle)){ @@ -240,11 +240,11 @@ Function Show-Graph { $XAxisTitle = " "*$LengthOfMaxYAxisLabel + (CenterAlignString $XAxisTitle $XAxis.Length) Write-Host -Object $VerticalEdge -NoNewline Write-Host -Object $XAxisTitle -ForegroundColor DarkYellow -NoNewline # Prints XAxisTitle - Write-Host -Object $(" "*$(($LengthOfMaxYAxisLabel + $XAxis.length) - $XAxisTitle.Length - 2)) $VerticalEdge + Write-Host -Object ($(" "*$(($LengthOfMaxYAxisLabel + $XAxis.length) - $XAxisTitle.Length - 2)) + " " + $VerticalEdge) } # bottom boundary - [string]::Concat($BottomLeft,$([string]$BottomEdge * $BottomBoundaryLength),$BottomRight) + Write-Host([string]::Concat($BottomLeft,$([string]$BottomEdge * $BottomBoundaryLength),$BottomRight)) } diff --git a/src/UtilityFunctions.ps1 b/src/UtilityFunctions.ps1 index 31f4b50..546f438 100644 --- a/src/UtilityFunctions.ps1 +++ b/src/UtilityFunctions.ps1 @@ -15,5 +15,5 @@ Function Write-Graph($YAxisLabelAlphabet, $YAxisLabel, $Row, $RowColor, $LabelCo Write-Host -Object "$($YAxisLabel.tostring().PadLeft($LengthOfMaxYAxisLabel+2) + [Char]9508)" -NoNewline ##Write-Host "$YAxisLabel|" -NoNewline Write-Host -Object $Row -ForegroundColor $RowColor -NoNewline - Write-Host -Object " " $([char]9474) + Write-Host -Object (" " + $([char]9474)) }