Skip to content

Lines and time

-Type line, area or step. A date column on -X gives a time axis with zoom; -Smooth smooths the lines, -SecondaryY puts named series on a second axis, -LogScale makes the value axis logarithmic, -Band Low, High shades a range around a line, -MarkArea marks a time window.

Time axis with zoom and a reference line

Dates become a time axis; the wheel zooms, the slider below shows the whole range.

$rng = [System.Random]::new(4)
$latency = foreach ($m in 0..287) { [pscustomobject]@{ Time = ([datetime]'2026-11-03').AddMinutes(5 * $m); Ms = [math]::Round(90 + 30 * [math]::Sin($m / 20) + $rng.Next(0, 20)) } }
New-UDEChart -Data $latency -Type area -X Time -Y Ms -MarkLine @{ value = 150; name = 'SLA'; color = '#e53935' } -Thresholds @{ value = 150; color = '#43a047' }, @{ value = 100000; color = '#e53935' } -Height 320px

Reference lines and pins

-MarkLine 'median', 'average' per series, or fixed lines: @{ value = 48; name = 'SLA'; color = '#e53935' } (axis = 'x' for a vertical line).

-MarkPoint 'max', 'min' pins those values on every series; @{ x = 'Thu'; y = 306; label = 'Outage' } pins one point (add series = 'Mail' for another series than the first).

Pins on single values

-MarkPoint max, min pins the extremes of every series.

$weeks = 1..12 | ForEach-Object { [pscustomobject]@{ Week = 'W{0:00}' -f (34 + $_); Windows = 20 + 9 * [math]::Sin($_); Linux = 12 + 6 * [math]::Cos($_ / 2) } }
New-UDEChart -Data $weeks -Type line -X Week -Y Windows, Linux -MarkPoint max, min -Format 'number:0' -Height 320px

-Trend Linear adds a dashed least-squares line per series. On a time or value axis, -Forecast 6 continues it six steps of the data, and -TrendTarget 100 continues it until it reaches 100 and marks the date - when a datastore is full or a licence count is used up.

Trend to a limit: when is the datastore full?

-Trend Linear with -TrendTarget continues the least-squares line and marks the date.

$fill = 0..59 | ForEach-Object { [pscustomobject]@{ Day = ([datetime]'2026-09-01').AddDays($_); Used = [math]::Round(60 + 0.42 * $_ + [math]::Sin($_) * 1.5, 1) } }
New-UDEChart -Data $fill -Type line -X Day -Y Used -Format 'percent100:0' -Trend Linear -TrendTarget 100 -YMax 105 -Height 320px

Axis breaks

New-UDEChartTimeBreak cuts nights and weekends out of a time axis, so business hours fill the chart; -YBreaks @{ start = 120; end = 1750 } keeps small bars readable next to one huge one.

Business hours only

New-UDEChartTimeBreak cuts nights and weekends out of the time axis.

$from = [datetime]'2026-11-02'; $to = $from.AddDays(5)
$samples = for ($t = $from; $t -lt $to; $t = $t.AddMinutes(30)) { if ($t.Hour -ge 7 -and $t.Hour -lt 19) { [pscustomobject]@{ Time = $t; Calls = 20 + 15 * [math]::Sin(($t.Hour - 7) / 2) } } }
New-UDEChart -Data $samples -Type line -X Time -Y Calls -Breaks (New-UDEChartTimeBreak -From $from -To $to -DayStart '07:00' -DayEnd '19:00') -Height 300px