Project

PSWriteOffice

PowerShell document automation across OfficeIMO's document, spreadsheet, presentation, PDF, Project, Access, EPUB, invoicing, and conversion engines.

Stars 654
Forks 82
Open issues 1
Total downloads 4,320,051
Release OfficeIMO-v3.5.3
Language: C# Updated: 2026-11-03
Cmdlet

Set-OfficeExcelChartTrendline

Aliases: ExcelChartTrendline
Module
PSWriteOffice
Aliases
ExcelChartTrendline
Inputs
OfficeIMO.Excel.ExcelChart
Outputs
OfficeIMO.Excel.ExcelChart

Adds or replaces an Excel chart series trendline.

Syntax

Set-OfficeExcelChartTrendline
[-Backward <Double>]
-Chart <ExcelChart>
[-DisplayEquation]
[-DisplayRSquared]
[-Forward <Double>]
[-Intercept <Double>]
[-LineColor <String>]
[-LineWidthPoints <Double>]
[-Order <Int32>]
[-PassThru]
[-Period <Int32>]
-SeriesIndex <Int32>
-Type <OfficeChartTrendlineType>
[<CommonParameters>]
#
Parameter set: Index
Set-OfficeExcelChartTrendline
[-Backward <Double>]
-Chart <ExcelChart>
[-DisplayEquation]
[-DisplayRSquared]
[-Forward <Double>]
[-IgnoreCase <Boolean>]
[-Intercept <Double>]
[-LineColor <String>]
[-LineWidthPoints <Double>]
[-Order <Int32>]
[-PassThru]
[-Period <Int32>]
-SeriesName <String>
-Type <OfficeChartTrendlineType>
[<CommonParameters>]
#
Parameter set: Name

Examples

Add a polynomial trendline.

$chart | Set-OfficeExcelChartTrendline -SeriesIndex 0 -Type Polynomial -Order 2 -DisplayEquation -DisplayRSquared

Adds a polynomial trendline to the first series.

Parameters

-Backward Double optional
Backward forecast units.
-Chart ExcelChart requiredpipeline: True (ByValue)
Chart to update.
-DisplayEquation SwitchParameter optional
Display the trendline equation.
-DisplayRSquared SwitchParameter optional
Display the R-squared value.
-Forward Double optional
Forward forecast units.
-Intercept Double optional
Trendline intercept.
-LineColor String optional
Trendline line color. Named colors and hexadecimal values are accepted.
-LineWidthPoints Double optional
Trendline line width in points.
-Order Int32 optional
Polynomial order.
-PassThru SwitchParameter optional
Emit the object created or changed by the command.
-Period Int32 optional
Moving-average period.
-SeriesIndex Int32 requiredsets: Index
Zero-based series index.
-Type OfficeChartTrendlineType required
Trendline type.
Possible values: Exponential, Linear, Logarithmic, MovingAverage, Polynomial, Power
-IgnoreCase Boolean optionalsets: Name
Ignore case when matching series name.
-SeriesName String requiredsets: Name
Series name.

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.