Skip to content

Perspective

New-UDPerspective puts Perspective into PSU apps: a datagrid, pivot table and chart in one. Readers group, split, filter, sort and aggregate the data themselves: Edit view above the viewer opens the editor, Table and Chart switch between the grid and a chart (Using the viewer); 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.

Install-PSResource -Name PowerShellUniversal.Component.Perspective

Datagrid that readers rearrange

Sort, filter and group in the editor (Edit view); Table and Chart switch between the grid and a chart. A click on a cell gives the row, as $EventData would.

$rng = [System.Random]::new(42)
$tickets = foreach ($i in 1..800) {
    [pscustomobject]@{
        Id        = 10000 + $i
        Created   = ([datetime]'2026-10-01').AddDays($rng.Next(0, 30)).AddHours($rng.Next(7, 19))
        Team      = ('Service Desk', 'Network', 'Server', 'Applications')[$rng.Next(0, 4)]
        Priority  = 'P{0}' -f $rng.Next(1, 5)
        Status    = ('Open', 'Waiting', 'Closed', 'Closed')[$rng.Next(0, 4)]
        LeadHours = [math]::Round(2 + 40 * $rng.NextDouble(), 1)
    }
}
New-UDPerspective -Data $tickets -Sort 'Created desc' -Height 420px -OnClick {
    Show-UDToast -Message ('Ticket {0}, {1}' -f $EventData.row.Id, $EventData.row.Team)
}

Data

-Data takes a DataTable, DataRows, PSCustomObjects, hashtables or a script block, like the chart module (a DataTable of 1000 rows or more is converted by a small class compiled once per PSU process: loading and performance). Column names keep their PowerShell spelling in the grid. Every column gets a type from its values: ISO dates and times become dates (sortable and filterable as dates), whole numbers up to 2,147,483,647 integers (Perspective's integers are 32 bit), other numbers floats, $true/$false booleans, everything else text.

New data for the same component replaces the rows and keeps the reader's layout; when the columns or their types change, the table is built anew and the view starts again from the parameters.

Next: Using the viewer, The starting view, Events, security and limits, Reference.