'Declaration Function Add( _ ByVal type As TrendlineType, _ Optional ByVal order As Integer, _ Optional ByVal period As Integer, _ Optional ByVal forward As Double, _ Optional ByVal backward As Double, _ Optional ByVal intercept As Double, _ Optional ByVal displayEquation As Boolean, _ Optional ByVal displayRSquare As Boolean, _ Optional ByVal name As String _ ) As ITrendline
'Usage Dim instance As ITrendlines Dim type As TrendlineType Dim order As Integer Dim period As Integer Dim forward As Double Dim backward As Double Dim intercept As Double Dim displayEquation As Boolean Dim displayRSquare As Boolean Dim name As String Dim value As ITrendline value = instance.Add(type, order, period, forward, backward, intercept, displayEquation, displayRSquare, name)
Parameters
- type
- The trendline type.
- order
- The trendline order when type is TrendlineType.Polynomial. Must be an integer from 2 to 6, inclusive.
- period
- The trendline period when type is TrendlineType.MovingAverage. Must be an integer greater than 1 and less than the number of data points in the series you are adding a trendline to.
- forward
- The number of periods (or units on a scatter chart) that the trendline extends forward.
- backward
- The number of periods (or units on a scatter chart) that the trendline extends backward.
- intercept
- The trendline intercept. If this argument is omitted, the intercept is automatically set by the regression.
- displayEquation
true
to display the equation of the trendline on the chart (in the same data label as the R-squared value).- displayRSquare
true
to display the R-squared value of the trendline on the chart (in the same data label as the equation).- name
- The name of the trendline as text.
Return Value
An ITrendline object that represents the new trendline.