Skip to content

Reference

From the comment-based help of the module (Get-Help New-UDPerspective -Full shows the same).

New-UDPerspective

A Perspective datagrid, pivot table and chart in one, for PowerShell Universal apps.

Pass the data as it comes - a DataTable from SQL, objects from Invoke-RestMethod or any PowerShell command. Readers rearrange the view themselves in the configuration panel: group and split by columns (a pivot), filter, sort, aggregate, switch between the datagrid and the charts. The parameters set the view it starts with. The data is held by Perspective's WebAssembly engine in a Web Worker in the browser, so tens of thousands of rows stay fast. Column names are matched without regard to case.

Parameter Type Description
-Id String Component id. Default: a new GUID.
-Data (required) Object Rows: a DataTable, objects, hashtables, or a script block returning them.
-Plugin String The view to start with: Datagrid (default) or a chart: X Bar, Y Bar, Y Line, Y Area, Y Scatter, X/Y Scatter, X/Y Line, Density, Treemap, Sunburst, Heatmap, Candlestick, OHLC, Map Scatter, Map Line, Map Density (the map charts need longitude and latitude columns).
-Columns String[] Columns to show, in this order. Default: all.
-GroupBy String[] Row groups (pivot rows), e.g. Customer, Team.
-SplitBy String[] Column groups (pivot columns), e.g. Priority.
-Aggregates Hashtable How grouped values are combined per column: @{ Tickets = 'sum'; LeadHours = 'avg' } (Perspective's names: sum, avg, count, distinct count, min, max, median, first, last, ...).
-Sort String[] 'Column' (ascending) or 'Column desc', one or more.
-Filter String[] 'Column == value', 'Column > 5', 'Column contains text', one or more.
-Settings SwitchParameter Open the configuration panel at the start (readers open and close it with "Edit view").
-ChartPlugin String The chart the toolbar's "Chart" button shows while the reader has not picked one in the panel: Y Bar (default), X Bar, Y Line, Y Area, Treemap, Heatmap, ... (any chart of -Plugin).
-Labels Hashtable Words of the toolbar in another language, any of: @{ EditView = 'Ansicht bearbeiten'; Table = 'Tabelle'; Chart = 'Diagramm' }. Missing keys keep the English label.
-NoToolbar SwitchParameter No toolbar above the viewer ("Edit view" and the Table/Chart switch); the configuration panel then opens only through the small arrow in the viewer's status bar.
-Config Hashtable Perspective's full viewer configuration (as from the viewer's "copy config"), merged over the one the parameters built.
-Height String Height, e.g. 480px (default) or 70vh.
-Width String Width. Default: the container's.
-Theme String Auto (follows the app's light/dark switch, default), Light or Dark.
-ClassName String CSS class of the outer element.
-Style Hashtable CSS styles of the outer element.
-OnClick Endpoint Runs on the server when a cell is clicked. $EventData: row (the values of the clicked row or group), columnNames, filter (the group and split values that lead to the cell, as [column, operator, value]).