Author

Portrait of Joannes Vermorel

I am Joannes Vermorel, founder at Lokad. I am also an engineer from the Corps des Mines who initially graduated from the ENS.

I have been passionate about computer science, software matters and data mining for almost two decades. (RSS - ATOM)

Meta
Tags
« VPS for continuous integration | Main | Iridium r8 released and new website fo Math.NET »
Sunday
Mar182007

Format-Graph CmdLet; Drawing graphics with PowerShell

PowerShell, through its object-oriented design, provides a flexible and powerful framework to build interactive shell commands. Lately, in order to produce quick&dirty graphs while working on Lokad, I came up with Format-Graph, a CmdLet that outputs a text-based graphics of curves extracted directly from the PowerShell pipeline.

Format-Graph screenshot

For those who might be interested, the source-code of the Format-Graph CmdLet is freely available as a part of the Lokad OpenShell project. The class is stand-alone, you not need the rest of the Lokad OpenShell project to get it working.

The key idea behind the Format-Graph is the way to actually retrieve, from the pipeline, the values to be plotted. Indeed, if the Format-Graph was relying on some arbitrary strong-typed inputs (think of a class named Point); then this CmdLet would be pretty much useless. Indeed, using the Format-Graph would require some heavy input formatting to actually produce anything. Instead, Format-Graph leverages the .Net reflexion to extract the values from the pipeline.

Basically, Format-Graph takes a ValuePropertyName argument that is used to extract the actual double value from the specified property. For example, in the screenshot here above, I have used -ValuePropertyName:Value to extract the values from TimeValue objects.

Future development notes: Format-Graph does not provides any axis description for now. I have already included a LabelPropertyName argument as a placeholder (labels are just ignored for now); but I am unsure about the way to handle the X axis description at this point. Additionally, I am considering to (optionally) display some scaling information for the Y axis.

References (1)

References allow you to track sources for this article, as well as articles that were written in response to this article.
  • Response
    Response: coffee roaster
    Format-Graph CmdLet; Drawing graphics with PowerShell - - - Joannes Vermorel's blog

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
All HTML will be escaped. Hyperlinks will be created for URLs automatically.