Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

endowdly/PSparklines

Open more actions menu

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

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.