編輯

共用方式為


Trendlines.Add Method

Definition

Creates a new trendline. Returns a Trendline object.

public Microsoft.Office.Interop.Excel.Trendline Add (Microsoft.Office.Interop.Excel.XlTrendlineType Type = Microsoft.Office.Interop.Excel.XlTrendlineType.xlLinear, object Order, object Period, object Forward, object Backward, object Intercept, object DisplayEquation, object DisplayRSquared, object Name);
Public Function Add (Optional Type As XlTrendlineType = Microsoft.Office.Interop.Excel.XlTrendlineType.xlLinear, Optional Order As Object, Optional Period As Object, Optional Forward As Object, Optional Backward As Object, Optional Intercept As Object, Optional DisplayEquation As Object, Optional DisplayRSquared As Object, Optional Name As Object) As Trendline

Parameters

Type
XlTrendlineType

Optional XlTrendlineType. The trendline type.

Order
Object

Optional Object. Required if Type is xlPolynomial. The trendline order. Must be an integer from 2 to 6, inclusive.

Period
Object

Optional Object. Required if Type is xlMovingAvg. The trendline period. Must be an integer greater than 1 and less than the number of data points in the series you're adding a trendline to.

Forward
Object

Optional Object. The number of periods (or units on a scatter chart) that the trendline extends forward.

Backward
Object

Optional Object. The number of periods (or units on a scatter chart) that the trendline extends backward.

Intercept
Object

Optional Object. The trendline intercept. If this argument is omitted, the intercept is automatically set by the regression.

DisplayEquation
Object

Optional Object. True to display the equation of the trendline on the chart (in the same data label as the R-squared value). The default value is False.

DisplayRSquared
Object

Optional Object. True to display the R-squared value of the trendline on the chart (in the same data label as the equation). The default value is False.

Name
Object

Optional Object. The name of the trendline as text. If this argument is omitted, Microsoft Excel generates a name.

Returns

Applies to