Joomla TemplatesWeb HostingWeb Hosting
12
Oct
PoshBoard 2.0.1034 : Out-PBChart, new datagrid feature, twitter news E-mail

An updated release is available for both PoshBoard.Web and PoshBoard.Snapin

Two new cmdlets for Charting, and a new parameter for PBDataGrid.

Out-PBChart and Out-PBChartSerie

Out-PBChart let you build chart based on the pipeline objects, as Out-PBDataGrid does. It let you design one-liner chart script.

Example :

get-process|select -first 20|out-pbchart handles -dpnames ProcessName -Name "Handles"

It get the "Handles" Property of Get-Process and render it as Column

DPNames parameter

The DPNAmes property let you specify an object property or string collection that will be used as Names for DataPoints names. Here we use the "ProcessName"  property as DataPoints names source.

If you set only one value for -DPName, the cmdlet will check for a property with the same name in the pipeline object (case insensitive). If a property is found, it uses it as a Name source. If not, it'll assume that the value provided is a string name. If you want to put your own name, be sure to provide as many names as your number of datapoints !

RenderAs parameter

By default, Rendering of series is of "Column" type. You can set the series rendering type with the -RenderAs Parameter.

get-process|sort handles -descending|out-pbchart handles,npm,CPU -RenderAs Area,Bar,Line -dpnames ProcessName

Legends parameter

Another example : here we take the CPU usage and render a StackedColumn Chart. I HardCode the DAtaPoints name (here: "CPU"). You can set the Boolean Legends parameter. If set to true, it renders the Chart Legend.

$Proc = gwmi Win32_PerfFormattedData_PerfOS_Processor |where{$_.name -eq "_total"}
$proc|out-pbchart PercentProcessortime,PercentIdleTime -renderAs StackedColumn -DPNames "CPU" -name CPU -legends $true

 

 

You can use every other parameter found in the New-PBChart and New-PBDataSerie object (like title, scrollingEnabled and so on...)

Out-PBChartSerie

It renders ChartSerie from a pipeline Object. Usefull to build chart from different objects, with a small amount of code. Here's a sample on how to use it :

$Proc = gwmi Win32_PerfFormattedData_PerfOS_Processor |where{$_.name -eq "_total"}
$chart = new-pbchart -Name "mychart" -Theme Theme3
$Chart.ChartSeries.Add(($proc|Out-PBChartserie PercentProcessorTime -RenderAs column -DPNames "ProcessName"))
$Chart.ChartSeries.Add(($proc|Out-PBChartserie PercentIdleTime -RenderAs column -DPNames "ProcessName"))
$chart

Out-PBDataGrid / New-PBDatagrid ColumnsWidth parameter

By default, PoshBoard datagrid was set up with "AutoSize" true. When you add your columns, they fit the datagrid width without any scrollbar. This is cool for small grid, but when you want to build "big" datagrid, you may want to set your own Columns width, and activate horizontal scrollbar.

The new ColumnsWidth parameter let you do just that. You can set a global width or specific width for each column.

Example :

get-service|out-pbdatagrid -columnswidth 150

This script transform every property of Get-Service in a datagrid, with a width of 150 pixels for each columns:

As you can see, a horizontal scrollbar appears, and every column are 150 pixels wide.

You can also specify custom width for EACH column :

get-service|Out-PBDatagrid Name,CanStop,CanShutDown,Status,DisplayName -ColumnsWidth 200,70,105,60,300

 

Download it now from Codeplex !

Follow PoshBoard updates on twitter

You can follow PoshBoard Development, Fresh news and release announcements on Twitter here

 

Have Fun !

antoine

 


Comments
Search
Only registered users can write comments!

3.26 Copyright (C) 2008 Compojoom.com / Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."

Last Updated on Monday, 12 October 2009 17:26