[]
Specifies how a chart trendline is calculated.
Use this enum with Type to choose the mathematical model used to fit a trendline to a data series, such as linear, logarithmic, polynomial, power, exponential, or moving-average analysis.
public enum TrendlineType
Public Enum TrendlineType
worksheet.Range["A1:B5"].Value = new object[,] {
{"Month", "Sales"}, {"Jan", 10}, {"Feb", 15}, {"Mar", 18}, {"Apr", 24}
};
IShape shape = worksheet.Shapes.AddChart(ChartType.ColumnClustered, 20, 20, 300, 200);
shape.Chart.SeriesCollection.Add(worksheet.Range["A1:B5"], RowCol.Columns, true, true);
ITrendline trendline = shape.Chart.SeriesCollection[0].Trendlines.Add();
trendline.Type = TrendlineType.Linear;
| Name | Description |
|---|---|
| Exponential | Uses an equation y=ab^x to calculate that the least squares fit through points. |
| Linear | Uses the linear equation y = mx + b to calculate that the least squares fit through points. |
| Logarithmic | Uses the equation y = c ln x + b to calculate that the least squares fit through points. |
| MovingAvg | Uses a sequence of averages computed from parts of the data series. The number of points equals the total number of points in the series less the number specified for the period. |
| Polynomial | Uses an equation y = ax^6 + bx^5 + cx^4 + dx^3 + ex^2 + fx + g to calculate that the least squares fit through points. |
| Power | Uses an equation y = ax^b to calculate that the least squares fit through points. |