Reference¶
From the comment-based help of the module (Get-Help New-UDEChart -Full shows the same).
New-UDEChart¶
An interactive Apache ECharts chart for PowerShell Universal apps.
Pass the data as it comes - a DataTable from SQL, objects from Invoke-RestMethod or any PowerShell command - name the columns, and the chart is built in the browser. Column names are matched without regard to case.
Zoom (mouse wheel, box), the toolbox (box zoom, line/bar/stack switch, restore, PNG, CSV and
Excel export), tooltips, hover highlighting and legend toggles are on by default. Light and
dark follow the app's theme switch. -Options takes any Apache ECharts option
(https://echarts.apache.org/en/option.html) and is merged over the generated one, so every
ECharts feature stays reachable: objects merge key by key, arrays element by element, an object
given for an array (yAxis = @{...}) applies to every element.
Chart types and the columns they use:
- line, area, step, bar, scatter:
-X(category, date or number),-Y(one or more numbers) or-Ywith-GroupBy(long data: one series per group value);-SecondaryYon a second axis - pie, donut, funnel:
-X(name),-Y(value) - heatmap:
-X,-Y(both categories),-Value - calendar:
-X(date),-Yor-Value - boxplot:
-X(group, optional),-Y(values) - quartiles, whiskers and outliers are computed - histogram:
-Y(values),-Bins- with a median line unless-MarkLinesays otherwise - candlestick:
-X(date),-Open,-Close,-Low,-High,-Volume(optional, own panel) - gauge:
-Y(value) of the first row,-Min,-Max - radar:
-X(name per series),-Y(the axes) - sankey:
-Source,-Target,-Value - treemap, sunburst:
-Path(columns from the root down, or one column with "a/b/c"),-Y(value) - waterfall:
-X(step),-Y(change),-Totals(steps that show the running total) - gantt:
-X(row: server, job, person),-Start,-End,-GroupBy(colour, e.g. status),-Value(text in the bar) - maintenance windows, job runs, on-call shifts - graph:
-Source,-Target, optional-Value,-GroupBy(group of the source node),-TargetGroup(group of the target node) - dependency and topology maps; drag, zoom, neighbours on hover - tree:
-Path(levels, e.g. vCenter, Cluster, Host, VM),-Orient,-Depth- collapsible hierarchy - chord:
-Source,-Target,-Value- overlaps or hand-overs between the same set of things - parallel:
-Y(dimensions),-X(name),-GroupBy(colour) - compare many items across many measures; drag along an axis to filter - themeriver:
-X(date),-GroupBy(category),-Y(value) - how a mix changes over time - matrix:
-Y(rows, e.g. customer),-GroupBy(columns, e.g. KPI),-X(time inside a cell),-Value,-CellType- a table of sparklines with one scale per column - polar:
-X(categories around the circle, e.g. hours),-Yor-GroupBy,-Stacked - radialbar:
-X(one ring per category),-Y,-Max(the longest ring, three quarters of the circle) - bump:
-X(period, in the order of the data),-GroupBy(item),-Y(value) - the rank of each item per period; equal values rank in the order the items first appear
| Parameter | Type | Description |
|---|---|---|
-Id |
String |
Component id for Get-UDElement, Set-UDElement, Sync-UDElement and Set-UDEChartData. |
-Data (required) |
Object |
Rows: a DataTable or DataView, objects, hashtables, or a script block returning them. |
-Type |
String |
Chart type, see the description. |
-X |
String |
Column for the x axis, the names (pie, funnel, radar) or the dates (calendar, candlestick). |
-Y |
String[] |
Value column(s). Without -Y, line/bar/area use every numeric column except -X and -GroupBy. |
-GroupBy |
String |
Column whose values become separate series (long data, e.g. one row per day and team). |
-Value |
String |
Value column for heatmap, calendar and sankey. |
-Path |
String[] |
Hierarchy columns for treemap and sunburst. |
-Source |
String |
Source column for sankey. |
-Target |
String |
Target column for sankey. |
-Open |
String |
Opening price column for candlestick. |
-Close |
String |
Closing price column for candlestick. |
-Low |
String |
Low price column for candlestick. |
-High |
String |
High price column for candlestick. |
-Volume |
String |
Volume column for candlestick (shown in a second panel). |
-Totals |
String[] |
Waterfall steps (values of -X) that show the running total, e.g. 'Q1', 'Year'. |
-Start |
String |
Start column for gantt. |
-End |
String |
End column for gantt. |
-Size |
String |
Bubble size column for scatter (area grows with the value). |
-Band |
String[] |
Two columns, lower and upper bound, drawn as a shaded range behind the series (forecast, confidence or normal operating range). |
-BandName |
String |
Name of the band in the legend. Default: " |
-MarkArea |
Object[] |
Shaded ranges: @{ from = '2026-11-03T02:00'; to = '2026-11-03T04:00'; name = 'Maintenance' } on the x axis, or with axis = 'y' a value range (e.g. the SLA corridor); color optional. |
-GaugeStyle |
String |
Progress (default, one value), Ring (one ring per row, e.g. availability per service) or Grade (arc coloured by -Thresholds, with a needle). |
-Thresholds |
Object[] |
Upper bounds with colours, ascending: @{ value = 95; color = '#e53935' }, @{ value = 99; color = '#fb8c00' }, @{ value = 100; color = '#43a047' } For -GaugeStyle Grade the bands of the dial; for line and area each stretch of the line in the colour of its band (e.g. red above an SLA), above the last bound in the last colour. |
-Rose |
SwitchParameter |
Pie and donut as a rose (Nightingale) chart: the radius shows the value. |
-TargetGroup |
String |
For graph: column naming the group of the target node (colour and legend). |
-Orient |
String |
For tree: LR (default), RL, TB, BT or Radial. |
-Depth |
Int32 |
For tree: levels open at the start (default 2); click a node to open or close it. |
-RootName |
String |
For tree: name of the common root when the data has several top-level values. |
-Layout |
String |
For graph: Force (default; nodes arrange themselves, drag to move), Circular, or Layered (left to right along the links, e.g. firewall > core switch > access switch > ESXi > VM). |
-EdgeLabel |
String |
For graph: column written on each link, e.g. the ports of a connection ('Gi1/0/12 > vmnic2'). |
-CellType |
String |
For matrix: Line (default), Area or Bar in each cell. |
-Undirected |
SwitchParameter |
For graph: lines without arrows (cabling, peerings). |
-MarkPoint |
Object[] |
Pins on single values: 'min', 'max', 'average' (per series) or @{ x = 'Thu'; y = 306; label = 'Outage'; series = 'Mail' } (one point; without series on the first). |
-LabelColumn |
String |
Show this column of the row behind each point as its label (every chart type). |
-LabelTemplate |
String |
Label text from the row: '{Name} ({Cpu} vCPU, {RamGB:integer} GB)'. A placeholder is a column, optionally with a format of -Format ('{Size:bytes}', '{Share:percent100:1}'); a list column is joined with commas; `n starts a new line. Points without a row of their own (a tree's folders, aggregated nodes) keep their name. |
-TooltipColumns |
String[] |
Columns of the row shown in the tooltip, one line each, optionally with a format and a label: 'Cpu', 'RamGB:integer', 'Used:bytes', 'Memory (GB)=RamGB:integer'. |
-TooltipTemplate |
String |
Tooltip text from the row, placeholders as in -LabelTemplate; `n starts a new line. Values are HTML-escaped. |
-Trend |
String |
Linear: a dashed least-squares trend line per series (line, area, bar, scatter). |
-Forecast |
Int32 |
With -Trend on a time or value axis: continue the trend for this many steps of the data. |
-TrendTarget |
Nullable1| With-Trend`: continue the trend until it reaches this value and mark the date (a datastore at 100 %, a licence limit). Only when that lies ahead and within five times the data's span. |
|
-TrendName |
String |
Legend name of the trend line. Default: ' |
-Title |
String |
Title above the chart. |
-Subtitle |
String |
Second line under the title. |
-Height |
String |
CSS height. Default: 400px. |
-Width |
String |
CSS width. Default: 100%. |
-ClassName |
String |
CSS class of the chart's outer element, as on PSU's own components. |
-Style |
Hashtable |
CSS styles of the chart's outer element, e.g. @{ marginTop = '8px'; border = '1px solid #ccc' }. |
-Theme |
String |
Auto (follows the app's light/dark switch), Light or Dark. |
-LightTheme |
Object |
Corporate design for the light mode: an Apache ECharts theme as a hashtable, or the path of a theme JSON file as the ECharts theme builder downloads it ("Download theme", JSON; the builder's project file is refused). Merged over the module's own theme: what the theme sets wins, the rest stays. For every chart of an app at once: $PSDefaultParameterValues['New-UDEChart:LightTheme'] = '/path/on/the/psu/server/corporate-light.json' |
-DarkTheme |
Object |
Corporate design for the dark mode, as -LightTheme. |
-Palette |
String[] |
Series colours, e.g. '#5470c6', '#91cc75'. |
-ColorMap |
IDictionary |
A fixed colour per category name, for every chart type: series names (-Y columns, -GroupBy values, gantt groups) and data item names (pie and funnel slices, treemap and sunburst nodes, sankey and graph nodes). @{ Failed = '#E3000F'; Success = '#287233' }; two colours for light and dark mode: @{ Failed = '#E3000F', '#FF6B6B' }. Names match without regard to case; categories not in the map keep the palette. Colours are hex, rgb(), rgba(), hsl(), hsla() or CSS names. |
-Legend |
String |
Bottom, Top, Left, Right or None. Default: Bottom when there is more than one series. |
-LegendType |
String |
Scroll (default): one line or column with paging arrows when the entries do not fit. Plain: all entries, wrapped over several lines (pie and donut make room for them). |
-Format |
String |
Value format for axis, tooltip and labels: number, number:2, integer, currency, currency:USD, percent (0.25 -> 25 %), percent100 (25 -> 25 %), compact, compactcurrency:EUR, bytes, duration (seconds), duration:min, duration:h, date, datetime, time, text. Numbers use the browser's locale or -Locale. |
-LabelFormat |
String |
Format for value labels (-DataLabels, pie, waterfall). Default: the short form of -Format (currency:EUR -> compactcurrency:EUR, "9,9 Mio. EUR" in de-DE), so long numbers do not overlap. |
-XFormat |
String |
Format for x axis labels, e.g. date. |
-Locale |
String |
Locale for numbers and dates, e.g. de-DE. Default: the browser's language. |
-XTitle |
String |
Name of the x axis. |
-YTitle |
String |
Name of the value axis. |
-SecondaryY |
String[] |
Columns drawn against a second value axis on the right. |
-SecondaryTitle |
String |
Name of the second value axis. |
-XAxisType |
String |
Auto (dates become a time axis), Category, Time or Value. |
-Min |
Nullable1` |
Lower bound (gauge, heatmap/calendar colour scale, radar). |
-Max |
Nullable1` |
Upper bound (gauge, heatmap/calendar colour scale, radar). |
-YMin |
Nullable1` |
Lower bound of the value axis. |
-YMax |
Nullable1` |
Upper bound of the value axis. |
-Bins |
Int32 |
Number of histogram bins. Default: from the number of values (Sturges). |
-Aggregate |
String |
Combine rows with the same x (and group): Sum, Avg, Count, Min or Max (line, area, bar, step, scatter, pie, donut, funnel, polar, radialbar; bump ranks by Sum by default). Without it the last row wins. Count counts rows; the others ignore empty values and leave a gap when there is none. On a time axis only rows with exactly the same timestamp combine: round dates first (to the day, the hour) to count events per day. |
-EmptyText |
String |
Text shown when -Data has no rows. Default: No data. |
-Stacked |
SwitchParameter |
Stack the series (line, area, bar). |
-Horizontal |
SwitchParameter |
Horizontal bars (bar, boxplot). |
-Normalize |
SwitchParameter |
Stack the series to 100 % per category (shares); the tooltip shows share and original value. |
-Smooth |
SwitchParameter |
Smooth lines. |
-LogScale |
SwitchParameter |
Logarithmic value axis. |
-DataLabels |
SwitchParameter |
Values on bars, points and slices (pie, donut and funnel show them by default). |
-MarkLine |
Object[] |
Reference lines: 'median', 'average', 'min', 'max' (per series) or @{ value = 48; name = 'SLA'; color = '#e53935' } (fixed; add axis = 'x' for a vertical line). |
-NegativeColor |
String |
Colour for negative bars (bar, waterfall). |
-PositiveColor |
String |
Colour for rising waterfall steps. |
-Breaks |
Object[] |
Gaps cut out of a time or value x axis: @{ start = ...; end = ...; gap = '1%' }, start and end as dates (time axis) or numbers. New-UDEChartTimeBreak builds them for nights and weekends. Not possible on category axes. |
-YBreaks |
Object[] |
Gaps cut out of the value axis, e.g. @{ start = 200; end = 5000 } when one bar dwarfs the rest. |
-Facet |
String |
Small multiples: one small chart per value of this column (e.g. one per weekday), all with the same value scale (line, area, step, bar, scatter). |
-FacetColumns |
Int32 |
Small multiples per row. Default: up to 4. |
-Sparkline |
SwitchParameter |
A tiny trend without axes, legend and toolbox, for tiles and tables (line, area, bar). Use with -Height, e.g. 60px. |
-Zoom |
String |
Auto (default: mouse wheel and drag; plus a slider with a preview of the data on time axes and with more than 60 categories), Inside (wheel and drag only), Slider, Both or None. |
-ZoomAxis |
String |
X (default: along the data), Y (the value axis, to look into small values next to large ones) or Both. With Both the mouse wheel zooms X, Shift + wheel zooms Y. |
-Brush |
SwitchParameter |
Select a range with the mouse (toolbox button); fires -OnSelect. |
-NoToolbox |
SwitchParameter |
Hide the toolbox. |
-NoExport |
SwitchParameter |
Hide the CSV and Excel buttons. |
-NoFullscreen |
SwitchParameter |
Hide the toolbox button that shows the chart alone on the whole screen (Esc returns). The button is hidden anyway where the browser cannot show an element full screen (iPhone Safari). |
-ExportColumns |
Object[] |
Columns of the CSV/Excel export, in order: names, or hashtables @{ field = 'leadTime'; title = 'Lead time (h)'; type = 'number'; format = 'number:1' } with type text, number, integer, currency, percent, date, datetime or boolean. Default: all columns of -Data with their types guessed. |
-EventColumns |
String[] |
Columns of the data row that events send back to the server ($EventData.row of a click, the rows of a parallel selection). Default: the whole row. Keeps messages small with wide rows; it does not hide data - everything in -Data is in the browser anyway. |
-ExportFileName |
String |
File name without extension for PNG, CSV and Excel. Default: the title. |
-Group |
String |
Charts with the same group share tooltip, zoom and legend. |
-Decal |
SwitchParameter |
Patterns on top of colours (helps colour-blind readers and black-and-white prints). |
-Renderer |
String |
Canvas (default, fast) or Svg (sharp when printed or scaled). |
-Options |
Hashtable |
Any Apache ECharts option, merged over the generated one. |
-OnClick |
Endpoint |
Runs when a bar, point or slice is clicked. $EventData: seriesName, seriesIndex, dataIndex, name, value, row (the clicked data row, when the chart has fewer than 20000 points). |
-OnSelect |
Endpoint |
Runs when a range is selected with -Brush. $EventData: from, to (ISO dates on a time axis, category names on a category axis, numbers otherwise). For parallel, after dragging along an axis: filtered, count and rows (the data rows of the lines still shown, at most 1000). |
-OnZoom |
Endpoint |
Runs after zooming. $EventData: from, to, start, end (percent). |
-OnLegendChange |
Endpoint |
Runs when a series is shown or hidden. $EventData: name, selected (map of all series). |
New-UDEChartTimeBreak¶
Axis breaks that cut nights and/or weekends out of a time axis (intraday charts, business hours).
Returns one break per night (between -DayEnd and the next -DayStart) and, with -Weekends, one per
weekend, between -From and -To, ready for New-UDEChart -Breaks. Dates are written in ISO 8601 with
the local offset, like the chart's own data, so the cuts line up with the points.
| Parameter | Type | Description |
|---|---|---|
-From (required) |
DateTime |
Start of the period. |
-To (required) |
DateTime |
End of the period. |
-DayStart |
TimeSpan |
Start of the visible part of a day. Default: 08:00. |
-DayEnd |
TimeSpan |
End of the visible part of a day. Default: 18:00. |
-Weekends |
SwitchParameter |
Also cut out Saturdays and Sundays completely. |
-Gap |
String |
Visual width of each cut, in percent of the axis. Default: 1%. |
Set-UDEChartData¶
Replaces the data of a chart on the page without redrawing the page (live updates).
Converts the data like New-UDEChart -Data and sends it with Set-UDElement. Zoom and hidden
series stay as they are. Call it from an endpoint or a timer (New-UDDynamic -AutoRefresh,
New-UDElement -AutoRefresh) inside the app.
| Parameter | Type | Description |
|---|---|---|
-Id (required) |
String |
Id of the chart (New-UDEChart -Id). |
-Data (required) |
Object |
Rows, as for New-UDEChart. |
-WhatIf |
SwitchParameter |
|
-Confirm |
SwitchParameter |