# New-ChartLegend

Creates a new chart legend with customizable options.

Project

PSWriteHTML

Generate HTML reports, dashboards, and emails from PowerShell without writing HTML, CSS, or JavaScript.

[View on GitHub](https://github.com/EvotecIT/PSWriteHTML) [Visit Website](#) [Releases](https://github.com/EvotecIT/PSWriteHTML/releases/tag/v1.41.0) [Changelog](#) [Get package](https://www.powershellgallery.com/packages/PSWriteHTML/1.40.0)

Stars **1,025**

Forks **114**

Open issues 

PowerShell Gallery downloads **7,576,901**

Release **v1.45.0**

Language: PowerShell Updated: 2026-11-19

Command 

**Module**

`PSWriteHTML`

Creates a new chart legend with customizable options.

## Syntax

```
New-ChartLegend
[[-Color] <String[]>]
[-DisableOnItemClickToggleDataSeries]
[-DisableOnItemHoverHighlightDataSeries]
[-Floating]
[[-FontFamily] <String>]
[[-FontSize] <Object>]
[[-FontWeight] <String>]
[-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>]
```

[#](#member-e78f15a5c9ccfe34ff175b68)

Parameter set: `All Parameter Sets`

## Description

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

## Examples

### Example 1

```powershell
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.

## Parameters

**-Color String[] optionalposition: 1**

Specifies an array of colors for the legend items.

**-DisableOnItemClickToggleDataSeries SwitchParameter optional**

Indicates whether to disable toggling data series on legend item click.

**-DisableOnItemHoverHighlightDataSeries SwitchParameter optional**

Indicates whether to disable highlighting data series on legend item hover.

**-Floating SwitchParameter optional**

Indicates whether the legend should float.

**-FontFamily String optionalposition: 9**

Specifies the font family of the legend labels.

**-FontSize Object optionalposition: 8**

Specifies the font size of the legend labels.

**-FontWeight String optionalposition: 10**

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 optional**

Indicates whether to hide the legend.

**-HorizontalAlign String optionalposition: 3**

Specifies the horizontal alignment of the legend labels (left, center, right).

Possible values: `left`, `center`, `right`

**-InverseOrder SwitchParameter optional**

Indicates whether to display legend items in reverse order.

**-ItemMarginHorizontal Nullable<T> optionalposition: 6**

Specifies the horizontal margin between legend items.

**-ItemMarginVertical Nullable<T> optionalposition: 7**

Specifies the vertical margin between legend items.

**-LegendPosition String optionalposition: 2**

Specifies the position of the legend (top, left, right, bottom).

Possible values: `top`, `left`, `right`, `bottom`

**-Names Array optionalposition: 0**

Specifies an array of names for the legend items.

**-OffsetX Nullable<T> optionalposition: 4**

Specifies the horizontal offset of the legend.

**-OffsetY Nullable<T> optionalposition: 5**

Specifies the vertical offset of the legend.

**-UseSeriesColors SwitchParameter optional**

Indicates whether to use series colors for legend items.

## 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](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters).

Evotec API Reference Copyright 2026 Evotec Services

<!-- PowerForge markdown artifact sha256:940D97D0E4CA88D9A2F452BDBBCB61BD42B1E4419516D682A497A2EBCC789915 -->
