[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.Drawing.ITrendline

ITrendline Interface

Represents a trendline in a chart.

A trendline shows the trend, or direction, of data in a series. Use this interface to configure how the trendline is calculated and displayed, such as its type, forward or backward projection, equation, and R-squared value.

Namespace: GrapeCity.Documents.Excel.Drawing
Assembly: DS.Documents.Excel.dll
Syntax
public interface ITrendline
Public Interface ITrendline
Examples
worksheet.Range["A1:B5"].Value = new object[,] {
    {"Month", "Sales"}, {"Jan", 10}, {"Feb", 15}, {"Mar", 18}, {"Apr", 24}
};
IShape shape = worksheet.Shapes.AddChart(ChartType.ColumnClustered, 200, 30, 300, 300);
shape.Chart.SeriesCollection.Add(worksheet.Range["A1:B5"], RowCol.Columns, true, true);
ITrendline trendline = shape.Chart.SeriesCollection[0].Trendlines.Add();
trendline.Type = TrendlineType.Linear;

Properties

Name Description
Backward

Gets or sets the number of periods, or units on a scatter chart, that the trendline extends backward.

Use this property to read the backward forecast length configured for the trendline. For scatter charts, the returned value represents units on the horizontal axis rather than category periods.

DataLabel

Gets the data label associated with the trendline.

DisplayEquation

Gets or sets whether the equation for the trendline is displayed on the chart.

DisplayRSquared

Gets or sets whether the trendline displays its R-squared value.

Format

Gets the chart format of the trendline.

Forward

Gets or sets the number of periods, or units on a scatter chart, that the trendline extends forward.

Use this property to read the forecast length configured for the trendline. For scatter charts, the returned value represents units on the horizontal axis rather than category periods.

Index

Gets the index number of this trendline within the collection of trendlines for the series.

The index identifies the trendline's position among similar objects in the same collection.

Intercept

Gets or sets the point where the trendline crosses the value axis.

Returns the fixed intercept value when the trendline intercept has been set explicitly.

Name

Gets or sets the name of the trendline.

Returns the custom name assigned to the trendline. If the trendline name is determined automatically, this property returns the current automatically generated name.

NameIsAuto

Gets or sets whether the trendline's name is automatically determined.

When this property is true, the trendline uses an automatically generated name. When it is false, the name can be controlled explicitly, for example by using Name.

Order

Gets or sets the trendline order when the trendline type is Polynomial.

The order specifies the degree of the polynomial trendline.

Parent

Gets the parent series of the trendline.

Use this property to access the ISeries that contains the current trendline.

Period

Gets or sets the period for the moving-average trendline.

This property applies to a trendline whose type is MovingAvg.

Type

Gets or sets the trendline type.

Methods

Name Description
ClearFormats()

Clears the formatting of this trendline.

Use this method to remove custom formatting that has been applied to the trendline.

Delete()

Deletes this trendline.

After this method is called, the trendline is removed from its parent chart series.