Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build/growth-baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"pages": {
"README.md": [110]
},
"totalLines": 5202
"totalLines": 5313
},
"javascript": {
"complexity": {
Expand All @@ -26,7 +26,7 @@
"modules/PowerShellUniversal.Component.ECharts.Demo/Apps/Showcase.ps1": [1330],
"modules/PowerShellUniversal.Component.Pivot.Demo/Apps/Showcase.ps1": [305],
"tests/powershell/Pivot.Tests.ps1": [521],
"tests/powershell/PivotReport.Tests.ps1": [1391],
"tests/powershell/PivotReport.Tests.ps1": [1408],
"tests/powershell/PivotTemplates.Tests.ps1": [729]
},
"functions": {
Expand Down
89 changes: 89 additions & 0 deletions docs/pivot/coming-from-ud-pivot.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
---
title: Coming from UniversalDashboard.Pivot
description: "Move an app from New-UDPivot of UniversalDashboard.Pivot to New-UDPivotReport: what each parameter becomes, and one report before and after."
---

# Coming from UniversalDashboard.Pivot

`New-UDPivotReport` replaces `New-UDPivot` of [UniversalDashboard.Pivot](https://github.com/eizedev/UniversalDashboard.Pivot),
which wraps react-pivottable.

## Requirements

- PowerShell 7.4 or later, in the PSU environment the app runs in. UniversalDashboard.Pivot also ran
on Windows PowerShell 5.1; this module does not load there.
- PowerShell Universal 2026.2 or 2026.3, tested with 2026.2.5 and 2026.3.4.

[Compatibility](../compatibility.md) has the details and how each version is tested.

## One report before and after

The start view moves from parameters into one `-View` ([Views](views.md#the-start-view-view)). The
same rows, before and after:

```powershell
$data = @(
@{ Team = 'OPS'; Status = 'Open'; Priority = 'High'; Hours = 5 }
@{ Team = 'OPS'; Status = 'Closed'; Priority = 'Low'; Hours = 2 }
@{ Team = 'OPS'; Status = 'Closed'; Priority = 'High'; Hours = 4 }
@{ Team = 'DEV'; Status = 'Open'; Priority = 'High'; Hours = 8 }
@{ Team = 'DEV'; Status = 'Closed'; Priority = 'Medium'; Hours = 3 }
@{ Team = 'DEV'; Status = 'Open'; Priority = 'Low'; Hours = 6 }
@{ Team = 'QA'; Status = 'Open'; Priority = 'Medium'; Hours = 1 }
@{ Team = 'QA'; Status = 'Closed'; Priority = 'High'; Hours = 7 }
)
# before
New-UDPivot -Id 'tickets-before' -Data $data -Rows 'Team' -Cols 'Status' -Vals 'Hours' -AggregatorName 'Sum' -RowOrder 'value_z_to_a' -ValueFilter @{ Priority = @{ Low = $true } }
# after
New-UDPivotReport -Id 'tickets-after' -Data $data -View @{
rows = @('Team')
cols = @('Status')
values = @(@{ field = 'Hours'; agg = 'sum' })
filters = @(@{ field = 'Priority'; type = 'in'; items = @('Low'); not = $true; blanks = 'include' })
sort = @(@{ field = 'Team'; by = 'value'; order = 'desc' })
}
```

Both show the sum of hours without the Low tickets, the teams by their total, highest first: DEV 11,
OPS 9, QA 8.

## Parameters

| `New-UDPivot` | `New-UDPivotReport` |
| --- | --- |
| `-Id`, `-Data` | `-Id`, `-Data`: also a DataTable ([Data and loading](data.md)) |
| `-Rows`, `-Cols` | `rows`, `cols` in `-View` |
| `-RowOrder`, `-ColOrder` | `key_a_to_z`: the default. `value_a_to_z`, `value_z_to_a`: `sort = @(@{ field = 'Team'; by = 'value'; order = 'asc' })` or `'desc'`, per row or column field. |
| `-ValueFilter` | `filters`: the listed items with `type = 'in'; not = $true; blanks = 'include'` ([Filters](filters.md)). |
| `-HiddenAttributes` | No counterpart: leave the column out of the rows you pass to `-Data` (`Select-Object -ExcludeProperty` for objects), so it does not reach the browser either. |
| `-HiddenFromAggregators`, `-HiddenFromDragDrop`, `-MenuLimit`, `-UnusedOrientationCutoff` | No counterpart. |

## Aggregators

`-Vals` and `-AggregatorName` become `values` in `-View`, each with its field and `agg`.

| `-AggregatorName` | `agg` in `values` |
| --- | --- |
| `Count` | `count` on a field: it counts the rows where the field has a value. |
| `Count Unique Values`, `List Unique Values` | `countUnique`, `listUnique` |
| `Sum`, `Integer Sum` | `sum`; for `Integer Sum` with `format = 'integer'` |
| `Average`, `Median`, `Minimum`, `Maximum`, `First`, `Last` | `average`, `median`, `min`, `max`, `first`, `last` |
| `Sample Variance`, `Sample Standard Deviation` | `var`, `stdev` |
| `Sum as Fraction of Total`, `of Rows`, `of Columns`; the same for `Count` | `sum` or `count` with `showAs = @{ type = 'percentOfGrandTotal' }`, `'percentOfRowTotal'`, `'percentOfColumnTotal'` |
| `Sum over Sum`, `80% Upper Bound`, `80% Lower Bound` | No counterpart. |

## Renderers

`-RendererName` becomes the value's `conditional` or the view's `display` and `chart`.

| `-RendererName` | In `-View` |
| --- | --- |
| `Table` | The default. |
| `Table Heatmap` | `conditional = @{ type = 'colorScale' }` on the value |
| `Grouped Column Chart`, `Stacked Column Chart` | `display = 'chart'; chart = @{ type = 'bar' }`; for stacked columns `chart = @{ type = 'bar'; stacked = $true }` |
| `Grouped Bar Chart`, `Stacked Bar Chart` | the same as the column charts, with `horizontal = $true` in `chart` |
| `Line Chart`, `Area Chart` | `display = 'chart'; chart = @{ type = 'line' }`, or `type = 'area'` |
| `Exportable TSV` | The reader's export copies the table as tab-separated text. |
| `Table Row Heatmap`, `Table Col Heatmap`, `Dot Chart`, `Scatter Chart`, `Multiple Pie Chart` | No counterpart. `type = 'pie'` draws one pie of the row totals. |

Next: [Views](views.md), [Data and loading](data.md), [Overview](index.md).
1 change: 1 addition & 0 deletions docs/pivot/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ New-UDPivotReport -Id 'tickets' -Data (Invoke-Sqlcmd -Query 'SELECT * FROM Ticke
| What readers get, and what the app decides for them | [Readers and your app](readers.md) |
| What `-Data` takes, large data | [Data and loading](data.md) |
| Every parameter | [Commands and parameters](reference.md) |
| Move an app from `New-UDPivot` | [Coming from UniversalDashboard.Pivot](coming-from-ud-pivot.md) |

Readers drag fields from a searchable list into **Rows**, **Columns**, **Values** and **Filters** and
get a table with totals or a chart, with date grouping, drill-down to the source rows, shared views and
Expand Down
2 changes: 1 addition & 1 deletion docs/pivot/reports-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ data you send. `-DataName` names the data, `-DataAsOf` says when it is from (sen
arrived).

`-Data` (and with it `-DataName` and `-DataAsOf`) and `-Parameter` need pivotkit-server 0.2.0 or
later.
later; `-Locale`, `-Numbers` and `-FlatHeader` ([Reports without a browser](reports.md#two-engines)) 0.3.0 or later.

The token comes from the server's operator, who makes it with `pivotkit-server token new`; keep it in
a PSU secret. pivotkit-server refuses a static token that is easy to guess
Expand Down
24 changes: 13 additions & 11 deletions docs/pivot/reports.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,26 @@ file's bytes, for an endpoint's answer or a mail attachment.
| Runs | pivotkit's command line on the PSU server | a pivotkit-server somewhere else |
| Needs | Node 24 or later and `npm install --global pivotkit-cli` (0.2.1 or later) on the PSU server | a pivotkit-server, its address and a token or OAuth client ([which server](reports-server.md#rest-a-pivotkit-server)) |
| Data | `-Data`, written to a temporary folder of its own (mode 0700 on Linux and macOS; on Windows it inherits the ACL of the user's TEMP folder), removed afterwards | `-Data`, sent in the request; or `-Source`, a source the server's operator configured |
| Language, time zone | `-Locale`, `-TimeZone` | the server's |
| Language, time zone | `-Locale`, `-TimeZone` | `-Locale`; the time zone is the server's |
| HTML print template | `-Template` | the server's source decides |
| Numbers and header of CSV and JSON | `-Numbers Shown` rounds to the decimals the view shows, `-FlatHeader` writes one CSV header row | the server's |
| Result | the file | the file, or a link that expires (`-AsLink`) |

Both take `-View` (a hashtable, JSON text or a view file) or `-Layout` (the view by field names), and
both check the view against the data first: a view with errors writes nothing, and the error lists
what pivotkit found (the field it did not find, the name it probably meant).

A CSV or JSON file holds every number with full precision. `-Numbers Shown` rounds each number to the
decimals the view shows; `-Numbers Full` is the default. `-FlatHeader` gives a CSV file one header
row instead of one per column field; each column names its labels joined with " / ". `-Locale` sets
the language and number format of a view that names none (a CSV in `de-DE` uses `;` and the decimal
comma). With the same `-Locale` and server settings, both engines write the same file. `-Numbers` and
`-FlatHeader` need pivotkit-cli 0.5.0 or later, and all three need pivotkit-server 0.3.0 or later;
the function refuses `-Numbers` and `-FlatHeader` for another format.

```powershell
Invoke-UDPivotReport -Engine Node -Data $tickets -View $view -OutFile ./tickets.csv -Numbers Shown -FlatHeader -Locale de-DE
```

```powershell
Invoke-UDPivotReport -Engine Node -Data $tickets -Format html -Title 'Lead time per month' -Layout @{
rows = 'Created'
Expand Down Expand Up @@ -77,15 +88,6 @@ stream. `-TimeoutSec` (default 120) stops a run that takes longer. A job that is
`pivotkit-<32 hex characters>` in the temporary folder of the account PSU runs as; remove such folders
now and then.

A CSV or JSON file holds every number with full precision. `-Numbers Shown` rounds each number to the
decimals the view shows, as pivotkit-server writes them; `-Numbers Full` is the default. `-FlatHeader`
gives a CSV file one header row instead of one per column field; each column names its labels joined
with " / ". Both need pivotkit-cli 0.5.0 or later, and the function refuses them for another format.

```powershell
Invoke-UDPivotReport -Engine Node -Data $tickets -View $view -OutFile ./tickets.csv -Numbers Shown -FlatHeader
```

An HTML report takes a print template of your own with `-Template`, for your company's look and
metadata. It goes with `-Format html` only (or an `-OutFile` that ends in `.html`):

Expand Down
80 changes: 80 additions & 0 deletions docs/pivot/theme-properties.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
title: Pivot theme properties
description: "Every CSS custom property New-UDPivotReport reads from the app's stylesheet: what it falls back to when unset, what it sets in the report, and its default in light and dark mode."
---

# Theme properties

The properties an app's stylesheet sets for the report, per light and dark mode, as
[Themes and corporate design](themes.md) shows. A property without a value falls back to the next one
in its row; without any, the report keeps the default of its mode. The rows from
`--psu-pivot-zone-rows` to `--psu-pivot-field-hover` take effect with pivotkit 0.11.0 or later in the
module; with an older pivotkit they set nothing. `--psu-pivot-chart-reference`, after them, needs no
minimum.

| Property | Falls back to | What it sets in the report | Light | Dark |
| --- | --- | --- | --- | --- |
| `--psu-chart-1` ... `--psu-chart-8` | - | series colours of the report's chart, by position; positions without a property keep theirs | pivotkit's palette | pivotkit's palette |
| `--psu-pivot-text` | `--psu-chart-text` | text | `rgba(0, 0, 0, 0.87)` | `rgba(255, 255, 255, 0.87)` |
| `--psu-pivot-muted` | `--psu-chart-muted` | secondary text, chart labels | `rgba(0, 0, 0, 0.62)` | `rgba(255, 255, 255, 0.64)` |
| `--psu-pivot-border` | `--psu-chart-axis` | borders of buttons, chips, panels and menus; the chart's axis line, unless an app sets one of the next row | `#e0e0e0` | `#2e2e2e` |
| `--psu-pivot-chart-axis` | `--psu-chart-axis` | the chart's axis line, apart from the table's lines | as `--psu-pivot-border` | as `--psu-pivot-border` |
| `--psu-pivot-grid` | `--psu-chart-grid` | lines between table cells, chart grid lines | `#eeeeee` | `#232323` |
| `--psu-pivot-accent` | `--psu-chart-accent` | primary buttons, badges, links, opened menus | `#1976d2` | `#90caf9` |
| `--psu-pivot-accent-text` | - | text on the accent | `#ffffff` | `#0b1a2a` |
| `--psu-pivot-focus` | `--psu-pivot-accent`, `--psu-chart-accent` | keyboard focus ring | `#1976d2` | `#90caf9` |
| `--psu-pivot-accent-soft` | 12 % (dark 18 %) of the corporate accent over the surface | badges, opened buttons, focused inputs | `#e3effb` | `#1b2a38` |
| `--psu-pivot-drop` | 18 % (dark 32 %) of the corporate accent over the surface | a zone while a field is dragged over it | `#d6e7f9` | `#1e3a55` |
| `--psu-pivot-note` | 7 % (dark 10 %) of the corporate accent over the surface | notes and hints | `#eef5fc` | `#16212c` |
| `--psu-pivot-surface` | - | background of the report and of the zones | `#ffffff` | `#121212` |
| `--psu-pivot-surface-2` | - | the zones' section, table headers, the field list's panel | `#f5f6f8` | `#1a1a1a` |
| `--psu-pivot-surface-3` | - | hovered controls, the Table/Chart switch | `#eaecef` | `#262626` |
| `--psu-pivot-surface-raised` | - | menus, popovers, the drill-down table, chart tooltips | `#ffffff` | `#1f1f1f` |
| `--psu-pivot-border-strong` | - | frame of a zone, hovered buttons and chips, the switch track, the grand-total line, scroll bars | `#c4c4c4` | `#474747` |
| `--psu-pivot-drop-border` | - | edge of a zone while a field is dragged | `#8a8a8a` | `#7a7a7a` |
| `--psu-pivot-input-border` | - | edge of a text field or a select in a menu | `#808080` | `#858585` |
| `--psu-pivot-rule` | - | line between a menu's groups | `#808080` | `#858585` |
| `--psu-pivot-total` | - | subtotals | `#f5f6f8` | `#1a1a1a` |
| `--psu-pivot-total-strong` | - | the grand total | `#eaecef` | `#242424` |
| `--psu-pivot-heat-low` | - | heatmap chart, lowest value | `#eaf1fb` | `#1d2735` |
| `--psu-pivot-heat-high` | - | heatmap chart, highest value | `#2a78d6` | `#3987e5` |
| `--psu-pivot-chart-other` | - | the grey slice "Other (n)" a pie or donut without a legend puts its smallest slices into; without a value, in the light theme the muted text, in the dark a fixed grey | `rgba(0, 0, 0, 0.62)` | `#6b7280` |
| `--psu-pivot-scale-low` | `--psu-pivot-heat-low` | colour scale of a value without colours of its own, lowest | `#eaf1fb` | `#1d2735` |
| `--psu-pivot-scale-mid` | - | colour scale of a value, middle: set, the scale has three colours | none | none |
| `--psu-pivot-scale-high` | `--psu-pivot-heat-high` | colour scale of a value without colours of its own, highest | `#2a78d6` | `#3987e5` |
| `--psu-pivot-type-string`, `--psu-pivot-type-number`, `--psu-pivot-type-date`, `--psu-pivot-type-boolean` | `--psu-pivot-muted`, `--psu-chart-muted` | the icon of a text, number, date or yes/no field and its pill in the empty report | `rgba(0, 0, 0, 0.62)` | `rgba(255, 255, 255, 0.64)` |
| `--psu-pivot-zone-rows` | - | the Rows zone: its icons, its marks in the field list, its fields' names in the table's header | `#1d5fcc` | `#8db4ff` |
| `--psu-pivot-zone-columns` | - | the Columns zone, the same parts | `#a85a00` | `#f2b559` |
| `--psu-pivot-zone-values` | - | the Values zone, the same parts, also on the grand total | `#0b785c` | `#5fd6ac` |
| `--psu-pivot-zone-filters` | `--psu-pivot-muted`, `--psu-chart-muted` | the Filters zone, the same parts | `rgba(0, 0, 0, 0.62)` | `rgba(255, 255, 255, 0.64)` |
| `--psu-pivot-zone-tint` | - | how much of its zone's colour a chip's fill takes | `16%` | `16%` |
| `--psu-pivot-zone-tint-base` | `--psu-pivot-surface` | what a chip's fill mixes the zone's colour into | `#ffffff` | `#121212` |
| `--psu-pivot-control-icon` | `--psu-pivot-muted`, `--psu-chart-muted` | a chip's grip, menu arrow and remove button | `rgba(0, 0, 0, 0.62)` | `rgba(255, 255, 255, 0.64)` |
| `--psu-pivot-sort-arrow` | `--psu-pivot-text`, `--psu-chart-text` | the sort arrow of the sorted field | `rgba(0, 0, 0, 0.87)` | `rgba(255, 255, 255, 0.87)` |
| `--psu-pivot-field-hover` | `--psu-pivot-surface` | a field in the field list on hover | `#ffffff` | `#121212` |
| `--psu-pivot-chart-reference` | `--psu-pivot-muted`, `--psu-chart-muted` | the chart's reference lines that belong to no series | `rgba(0, 0, 0, 0.62)` | `rgba(255, 255, 255, 0.64)` |
| `--psu-pivot-tab-bg` | - | a tab not shown (Table, Chart): its background | `transparent` | `transparent` |
| `--psu-pivot-tab-text` | `--psu-pivot-muted`, `--psu-chart-muted` | a tab not shown: its text | `rgba(0, 0, 0, 0.62)` | `rgba(255, 255, 255, 0.64)` |
| `--psu-pivot-tab-selected-bg` | `--psu-pivot-surface` | the tab shown: its background | `#ffffff` | `#121212` |
| `--psu-pivot-tab-selected-text` | `--psu-pivot-accent`, `--psu-chart-accent` | the tab shown: its text | `#1976d2` | `#90caf9` |
| `--psu-pivot-icon-button-text` | `--psu-pivot-muted`, `--psu-chart-muted` | a button with only an icon (a field's menu, Close, folding the field list): the icon | `rgba(0, 0, 0, 0.62)` | `rgba(255, 255, 255, 0.64)` |
| `--psu-pivot-icon-button-hover-bg` | `--psu-pivot-surface-3` | such a button on hover and while its menu is open | `#eaecef` | `#262626` |
| `--psu-pivot-button-border` | `--psu-pivot-border`, `--psu-chart-axis` | the frame of a button (the toolbar's, Table settings, Enlarge, Full screen) | `#e0e0e0` | `#2e2e2e` |
| `--psu-pivot-button-border-hover` | `--psu-pivot-border-strong` | the frame of a button on hover | `#c4c4c4` | `#474747` |
| `--psu-pivot-primary-bg` | `--psu-pivot-accent`, `--psu-chart-accent` | the main action of a dialog (Apply, Save, Load): its fill and frame | `#1976d2` | `#90caf9` |
| `--psu-pivot-primary-text` | `--psu-pivot-accent-text` | the main action's text | `#ffffff` | `#0b1a2a` |
| `--psu-pivot-primary-hover-bg` | - | the main action's fill on hover | 88 % of its fill, mixed with the text colour | 88 % of its fill, mixed with the text colour |
| `--psu-pivot-radius` | - | corner radius of the report, panels, zones and popovers | `8px` | `8px` |
| `--psu-pivot-radius-sm` | - | corner radius of buttons, chips, notes, the fields in the field list and their hover, and a field's name in the table's header; pivotkit's smaller corners (links, a chip's grip, badges, a field's type icon) follow it. `4px` is PSU's own corner; pivotkit's is `7px`. Chips and the table's field names follow it with pivotkit 0.11.0 or later | `4px` | `4px` |
| `--psu-pivot-font` | - | font family | the page's font | the page's font |
| `--psu-pivot-font-size` | - | base text size | `max(14px, 1em)` | `max(14px, 1em)` |
| `--psu-pivot-weight-normal` | - | plain text inside a bolder part (hints, table cells) | `400` | `400` |
| `--psu-pivot-weight-medium` | - | light emphasis (row labels, segmented buttons) | `500` | `500` |
| `--psu-pivot-weight-strong` | - | titles, field chips, buttons, subtotals, the admin panel's titles | `600` | `600` |
| `--psu-pivot-weight-bold` | - | grand totals, step numbers | `700` | `700` |

The report's chart has eight series colours. `--psu-chart-9` ... `--psu-chart-12`, `--psu-chart-tooltip`,
`--psu-chart-tooltip-border` and `--psu-chart-font-size` are ECharts only; the report's tooltips use
`--psu-pivot-surface-raised`.

Next: [Themes and corporate design](themes.md), [Commands and parameters](reference.md).
Loading
Loading