API Reference
Function
New-ChartLegend
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
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 SetsParameters
- Color String[]
- Specifies an array of colors for the legend items.
- DisableOnItemClickToggleDataSeries SwitchParameter
- Indicates whether to disable toggling data series on legend item click.
- DisableOnItemHoverHighlightDataSeries SwitchParameter
- Indicates whether to disable highlighting data series on legend item hover.
- Floating SwitchParameter
- Indicates whether the legend should float.
- FontFamily String
- Specifies the font family of the legend labels.
- FontSize Object
- Specifies the font size of the legend labels.
- FontWeight String
- 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
- Indicates whether to hide the legend.
- HorizontalAlign String
- Specifies the horizontal alignment of the legend labels (left, center, right).
- Possible values:
left,center,right - InverseOrder SwitchParameter
- Indicates whether to display legend items in reverse order.
- ItemMarginHorizontal Nullable`1
- Specifies the horizontal margin between legend items.
- ItemMarginVertical Nullable`1
- Specifies the vertical margin between legend items.
- LegendPosition String
- Specifies the position of the legend (top, left, right, bottom).
- Possible values:
top,left,right,bottom - Names Array
- Specifies an array of names for the legend items.
- OffsetX Nullable`1
- Specifies the horizontal offset of the legend.
- OffsetY Nullable`1
- Specifies the vertical offset of the legend.
- UseSeriesColors SwitchParameter
- Indicates whether to use series colors for legend items.