mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-23 18:38:19 +02:00
Update write-chart.ps1
This commit is contained in:
parent
8d159d4614
commit
a39508856b
@ -2,9 +2,8 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
function DrawBar { param([string]$Name, [float]$Value)
|
function WriteChartLine { param([string]$Text, [float]$Value, [float]$Max)
|
||||||
write-host -noNewLine "$($Name): "
|
$Num = ($Value * 40.0) / $Max
|
||||||
$Num = $Value
|
|
||||||
while ($Num -ge 1.0) {
|
while ($Num -ge 1.0) {
|
||||||
write-host -noNewLine "█"
|
write-host -noNewLine "█"
|
||||||
$Num -= 1.0
|
$Num -= 1.0
|
||||||
@ -24,10 +23,14 @@ function DrawBar { param([string]$Name, [float]$Value)
|
|||||||
} elseif ($Num -ge 0.125) {
|
} elseif ($Num -ge 0.125) {
|
||||||
write-host -noNewLine "▏"
|
write-host -noNewLine "▏"
|
||||||
}
|
}
|
||||||
write-host " $($Value)%"
|
if ($Max -eq 100.0) {
|
||||||
|
write-host " $($Value)% $Text"
|
||||||
|
} else {
|
||||||
|
write-host " $Value / $Max $Text"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
"2021 Wins"
|
"2021 Wins"
|
||||||
DrawBar "Markus" 6.5
|
WriteChartLine "Markus" 40.5 100.0
|
||||||
DrawBar "Andrea" 3.9
|
WriteChartLine "Andrea" 30.9 100.0
|
||||||
exit 0
|
exit 0
|
||||||
|
Loading…
Reference in New Issue
Block a user