Plot Graph in Powershell console


Introduction:

Recently, I was working on my Twiter bot (https://twitter.com/WittyHumorBot) completely written in Powershell, but part automating multiple jobs that run continuously on my screen, I managed to write a script to set all PowerShell consoles automatically in a grid layout like in the below image

grid

But I was not able to do that with taskmgr.exe in order to monitor performance bottlenecks and which was not at all customizable to my needs.

gigy

Features and Script:

So I decided to write a function that is customizable and can display a graph in a Powershell console which can also be set in an Automated grid layout (I’ll share the grid layout script in a later blog post).

Also,

  • I want to Color-code the output depending upon the Value of the Datapoint; Above/below some predefined thresholds 

    Example1

  • Display custom information  on X and Y-Axis labelsExample2
  • A Graph in the console that is independent and fully customizable, not like Task Manager’s (no need to switch to Performance Tab) and,
  • which could be easily used in any Powershell script to monitor performance on any defined parameter, which I see as the biggest benefit of the function.
  • The function consumes data points, generated during script execution or Pre-stored data like from a file or database.Example3

Following is the full script and here is the link to the Github Project, please feel free to contribute as I still see some possibilities of improvement.

Hope you’ll find the script useful and Thanks for reading.

Please do follow me on twitter for more Interesting PowerShell material and don’t forget to Showoff your Powershell console graph to your colleagues, Cheers! 😉

signature

Advertisements

9 thoughts on “Plot Graph in Powershell console

  1. Great Script, but It just display normal in my ISE console, can’t correct display in my powershell console,
    What is the default setting value for the console size??

    Liked by 2 people

  2. Good news, is it possible to add more types of graph(just like pie chart, bar chart, scatter…etc) at the future version? it will get more convenience for data analysis.

    Like

    1. Definitely, I’ve been thinking in same lines. lets see how it goes- bar and scatter charts are possible, but in console its bit tricky to make a pie chart, but that doesn’t means it is not possible. Moreover WinForms could be used to make something like Python’s – ‘MatPlotLib’ in Powershell, which is my ultimate goal. Future has amazing possibilities 😉

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s