ECharts¶
New-UDEChart draws interactive Apache ECharts charts in PSU apps: name
the columns of the data, pick a type, and the chart comes with zoom, tooltips, range selection, click
events, light and dark theme and CSV/Excel export.
Install-PSResource -Name PowerShellUniversal.Component.ECharts
First charts¶
A bar chart from any PowerShell objects¶
Name the columns; the chart picks a category axis for text and a value axis for numbers.
$sales = 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun' | ForEach-Object -Begin { $i = 0 } -Process {
$i++; [pscustomobject]@{ Month = $_; Online = 100 + 12 * $i; Store = 160 - 5 * $i }
}
New-UDEChart -Data $sales -Type bar -X Month -Y Online, Store -Height 320px
Long data: one series per group¶
-GroupBy splits rows into series, in natural order (P1, P2 ... P10).
$tickets = foreach ($team in 'Service Desk', 'Network', 'Server') {
foreach ($p in 'P1', 'P2', 'P3') { [pscustomobject]@{ Team = $team; Priority = $p; Tickets = 10 * $team.Length + 7 * [int]$p.Substring(1) } }
}
New-UDEChart -Data $tickets -Type bar -X Team -Y Tickets -GroupBy Priority -Stacked -DataLabels -Height 320px
Chart types¶
-Type |
Columns | Notes | Examples |
|---|---|---|---|
line, area, step, bar, scatter |
-X, -Y (one or more), -GroupBy |
-Stacked, -Normalize (100 %), -Horizontal, -Smooth, -SecondaryY, -LogScale |
Bars, Lines and time |
pie, donut, funnel |
-X (name), -Y (value) |
labels with value and share | Shares |
heatmap |
-X, -Y (categories), -Value |
colour scale with -Min, -Max |
Heatmaps and calendars |
calendar |
-X (date), -Y |
one calendar per year, limited to the days with data | Heatmaps and calendars |
boxplot |
-X (group), -Y (values) |
quartiles, whiskers and outliers are computed | Distributions |
histogram |
-Y (values), -Bins |
median line unless -MarkLine says otherwise |
Distributions |
candlestick |
-X (date), -Open, -Close, -Low, -High, -Volume |
volume in its own panel | Finance |
gauge |
-Y (first row), -Min, -Max |
-GaugeStyle Progress \| Ring \| Grade, -Thresholds |
Operations |
radar |
-X (series name), -Y (axes) |
Comparisons | |
sankey |
-Source, -Target, -Value |
Relations | |
treemap, sunburst |
-Path (columns from the root, or one column "a/b/c"), -Y |
click to zoom in | Shares |
waterfall |
-X (step), -Y (change), -Totals |
steps in -Totals show the running total |
Finance |
gantt |
-X (lane), -Start, -End, -GroupBy (colour), -Value (label) |
backup windows, maintenance, on-call; zoom along time | Operations |
graph |
-Source, -Target, -GroupBy, -TargetGroup |
dependencies and topology; -Layout Force \| Circular \| Layered, -EdgeLabel (ports on the lines), -Undirected |
Relations |
tree |
-Path (levels, or one column "a/b/c") |
folders, vCenter > cluster > host > VM; -Orient LR \| TB \| Radial, -Depth, -RootName |
Relations |
chord |
-Source, -Target, -Value |
overlaps or hand-overs between the same set of things | Relations |
parallel |
-Y (axes), -X (name), -GroupBy |
many items across many measures; drag along an axis to filter | Comparisons |
themeriver |
-X (date), -GroupBy, -Y |
how a mix of categories changes over time | |
matrix |
-Y (rows), -GroupBy (columns), -X (inside a cell), -Value, -CellType |
a table of sparklines, e.g. KPIs per customer; one scale per column | Comparisons |
polar |
-X (around the circle), -Y or -GroupBy |
hours of the day, weekdays; -Stacked |
Comparisons |
radialbar |
-X (one ring each), -Y, -Max |
progress per customer or service; the longest ring is three quarters of the circle | Comparisons |
bump |
-X (period), -GroupBy (item), -Y (value) |
the rank of each item per period, highest value first | Comparisons |
More: -Facet <column> draws one small chart per value with a shared scale (small multiples),
-Sparkline a tiny trend without axes for tiles (line, area, bar), -Breaks/-YBreaks cut ranges out
of an axis, -Rose turns a pie into a Nightingale chart, -Band Low, High shades a range, -MarkArea
marks a time window. Everything else in Apache ECharts is one -Options hashtable away;
the gallery page maps the Apache ECharts gallery to parameters.
All parameters: Reference.