Skip to content
ConsoleMonster
Cmdlet

New-ConsoleBarItem

Module ConsoleMonster
Inputs
None
Outputs
ConsoleMonster.Widgets.ChartItem

Creates one bar of a bar chart, or one segment of a stacked bar, with its own tone.

Syntax

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

Description

Creates one bar of a bar chart, or one segment of a stacked bar, with its own tone.

Use it inside the script block of New-ConsoleBarChart when a bar or a segment needs its own colour: -Tone takes a theme role (Pass, Fail, Warn, Skip, Info, Accent, Accent2, Muted, Series1 to Series6). Without -Tone the chart's colour is used, and a stacked bar picks the next series colour. The label is shown literally; rich text from New-ConsoleText keeps its colours. To add bars to a chart made earlier, pipe the chart to Add-ConsoleItem.

Examples

Authored help example

EXAMPLE 1

New-ConsoleBarChart -Stacked {
    New-ConsoleBarItem 'Passed' 412 -Tone Pass
    New-ConsoleBarItem 'Warnings' 51 -Tone Warn
    New-ConsoleBarItem 'Failed' 23 -Tone Fail
} | Write-ConsoleWidget

Results as a stacked bar

EXAMPLE 2

New-ConsoleBarChart -Unit ' ms' {
    New-ConsoleBarItem 'Cloudflare' 12
    New-ConsoleBarItem 'Quad9' 64 -Tone Warn
} | Write-ConsoleWidget

One bar picked out

Parameters

-Label Object requiredposition: 0
The label (shown literally; rich text from New-ConsoleText keeps its colours).
-Tone ThemeToken optional
The colour as a theme role: Pass, Fail, Warn, Skip, Info, Accent, Accent2, 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 requiredposition: 1
The value.

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.