Skip to content

endowdly/PSparklines

Repository files navigation

PSparklines

Sparklines for PowerShell!

Install

PowerShell Gallery

Install-Module PSparklines # -Scope CurrentUser

Scoop

scoop bucket add endo-scoop "https://github.com/endowdly/endo-scoop"  # Name the bucket whatever you'd like :)
scoop install psparklines

Examples

PS> Get-Sparkline 1,2,3,4,5,6,7,8 | Write-Sparkline

▁▂▃▄▅▆▇█


PS> $n = (0..10).Foreach{ Get-Random -Minimum 1 -Maximum 100 }

# 36, 32, 20, 55, 2, 35, 39, 48, 66, 86, 55

PS> Get-Sparkline $n -NumLines 3 | Write-Sparkline
        ▃█
▂▁ █ ▂▃▆███
██▆█▁██████

PS> Get-Sparkline $n -NumLines 3 -Emphasis @(
    New-Emphasis -Color 55 -Predicate { param($x) $x -like '5*' } # 55 is like a dark magenta
    New-Emphasis -Color 'Red' -Predicate { param($x) $x -gt 50 }
    New-Emphasis -Color 'Green' -Predicate { param($x) $x -eq 36 }
) | Show-Sparkline 

Result

# To show the difference between 4 bit color and 8 bit color *if your console supports VT ANSI commands and 8 bit color*

PS> Get-Sparkline $n -NumLines 3 -Emphasis @(
    New-Emphasis -Color 55 -Predicate { param($x) $x -like '5*' } # 55 is like a dark magenta
    New-Emphasis -Color 'Red' -Predicate { param($x) $x -gt 50 }
    New-Emphasis -Color 'Green' -Predicate { param($x) $x -eq 36 }

) | Show-Sparkline -Ansi

Result

Emphasis

As shown above, the first Emphasis object that has a true predicate will determine the color of the spark index.

Why?

This is just a quick little module to help visualize sparklines in the command-line. It is explained better in the sparklines repo. The Wikipedia entry also offers insight.

About

Sparklines for PowerShell!

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy