Evotec

Project

PSWriteHTML

PSWriteHTML is an open-source PowerShell project with packages, release history, and working documentation.

Stars 995
Forks 114
Open issues 69
PowerShell Gallery downloads 7,436,513
Release v1.41.0
Language: PowerShell Updated: 2026-04-11

API Reference

Function

New-ChartLegend

Namespace PSWriteHTML

Creates a new chart legend with customizable options.

Remarks

The New-ChartLegend function creates a new chart legend with various customization options such as position, alignment, font settings, and more.

Examples

Authored help example

EXAMPLE 1


New-ChartLegend -Names @('A', 'B', 'C') -Color @('red', 'blue', 'green') -LegendPosition 'top' -HorizontalAlign 'center' -FontSize 12
        

Creates a new chart legend with three items ('A', 'B', 'C') in red, blue, and green colors positioned at the top with center alignment and font size of 12.

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.

Syntax

New-ChartLegend [-Color <String[]>] [-DisableOnItemClickToggleDataSeries] [-DisableOnItemHoverHighlightDataSeries] [-Floating] [-FontFamily <String>] [-FontSize <Object>] [-FontWeight <normal>] [-HideLegend] [-HorizontalAlign <left|center|right>] [-InverseOrder] [-ItemMarginHorizontal <Nullable`1>] [-ItemMarginVertical <Nullable`1>] [-LegendPosition <top|left|right|bottom>] [-Names <Array>] [-OffsetX <Nullable`1>] [-OffsetY <Nullable`1>] [-UseSeriesColors] [<CommonParameters>]
#
Parameter set: All Parameter Sets

Parameters

Color String[] optionalposition: 1pipeline: False
Specifies an array of colors for the legend items.
DisableOnItemClickToggleDataSeries SwitchParameter optionalposition: namedpipeline: False
Indicates whether to disable toggling data series on legend item click.
DisableOnItemHoverHighlightDataSeries SwitchParameter optionalposition: namedpipeline: False
Indicates whether to disable highlighting data series on legend item hover.
Floating SwitchParameter optionalposition: namedpipeline: False
Indicates whether the legend should float.
FontFamily String optionalposition: 9pipeline: False
Specifies the font family of the legend labels.
FontSize Object optionalposition: 8pipeline: False
Specifies the font size of the legend labels.
FontWeight String optionalposition: 10pipeline: Falsevalues: 13
Specifies the font weight of the legend labels.
Possible values: normal, bold, bolder, lighter, 100, 200, 300, 400, 500, 600, 700, 800, 900
HideLegend SwitchParameter optionalposition: namedpipeline: False
Indicates whether to hide the legend.
HorizontalAlign String optionalposition: 3pipeline: Falsevalues: 3
Specifies the horizontal alignment of the legend labels (left, center, right).
Possible values: left, center, right
InverseOrder SwitchParameter optionalposition: namedpipeline: False
Indicates whether to display legend items in reverse order.
ItemMarginHorizontal Nullable`1 optionalposition: 6pipeline: False
Specifies the horizontal margin between legend items.
ItemMarginVertical Nullable`1 optionalposition: 7pipeline: False
Specifies the vertical margin between legend items.
LegendPosition String optionalposition: 2pipeline: Falsevalues: 4
Specifies the position of the legend (top, left, right, bottom).
Possible values: top, left, right, bottom
Names Array optionalposition: 0pipeline: False
Specifies an array of names for the legend items.
OffsetX Nullable`1 optionalposition: 4pipeline: False
Specifies the horizontal offset of the legend.
OffsetY Nullable`1 optionalposition: 5pipeline: False
Specifies the vertical offset of the legend.
UseSeriesColors SwitchParameter optionalposition: namedpipeline: False
Indicates whether to use series colors for legend items.