[]
Creates a new trendline and adds it to this collection.
Use this method to create a trendline for the parent series and then configure the returned ITrendline object.
ITrendline Add()
Function Add() As ITrendline
| Type | Description |
|---|---|
| ITrendline | The created ITrendline object. |
worksheet.Range["A1:B4"].Value = new object[,] {
{"Month", "Sales"},
{"Jan", 10},
{"Feb", 12},
{"Mar", 15}
};
IChart chart = worksheet.Shapes.AddChart(ChartType.ColumnClustered, 20, 20, 300, 200).Chart;
chart.SeriesCollection.Add(worksheet.Range["A1:B4"], RowCol.Columns, true, false);
ITrendline trendline = chart.SeriesCollection[0].Trendlines.Add();
trendline.Type = TrendlineType.Linear;