Skip to content
ConsoleMonster
Cmdlet

New-ConsoleChartSeries

Module ConsoleMonster
Inputs
System.Double[]
Outputs
ConsoleMonster.Widgets.ChartSeries

Creates one series of a line or scatter chart: a name, values and an optional tone.

Syntax

New-ConsoleChartSeries [-Name] <Object> [-Tone <ThemeToken>] [[-Value] <Double[]>] [<CommonParameters>]
#
Parameter set: All Parameter Sets

Description

Creates one series of a line or scatter chart: a name, values and an optional tone.

Use it inside the script block of New-ConsoleLineChart. Values come from -Value or from the pipeline, oldest first, and are spaced evenly. -Tone takes a theme role (Accent, Accent2, Pass, Fail, Warn, Series1 to Series6); without it the chart picks the next series colour, and a series named with a status word (failed, passed, warnings) takes that status colour. To add a series to a chart made earlier, pipe the chart to Add-ConsoleItem; in a running dashboard, append values with Add-ConsoleValue -Key.

Examples

Authored help example

EXAMPLE 1

$completed = foreach ($i in 0..47) { 20 + 9 * [math]::Sin($i / 7) + $i % 3 }
$failed = foreach ($i in 0..47) { 3 + 2 * [math]::Cos($i / 5) }
New-ConsoleLineChart -Height 7 {
    New-ConsoleChartSeries 'completed' -Value $completed -Tone Accent
    New-ConsoleChartSeries 'failed' -Value $failed -Tone Fail
} | Write-ConsoleWidget

Two series computed in the script

EXAMPLE 2

New-ConsoleLineChart -Scatter -Unit 'ms' {
    Get-Content latency.txt | New-ConsoleChartSeries 'latency'
} | Write-ConsoleWidget

Values from the pipeline

Parameters

-Name Object requiredposition: 0
The series name, shown in the legend (rich text from New-ConsoleText keeps its colours).
-Tone ThemeToken optional
The colour as a theme role: Accent, Accent2, Pass, Fail, Warn, Info, Muted or Series1 to Series6.
Possible values: Text, Muted, Subtle, Accent, Accent2, Pass, Fail, Warn, Info, Skip, Running, Pending, Border, Title, Header, Highlight, Surface, SurfaceAccent, Series1, Series2, Series3, Series4, Series5, Series6, Focus
-Value Double[] optionalposition: 1pipeline: True (ByValue)
The values, oldest first (pipeline input works too).

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.