[]
Adds data points from the specified range to the existing series in this collection.
Use this method to extend a chart with additional source data after the initial
series have already been added. The rowcol parameter determines whether the
new values are read by rows or by columns, and categoryLabels specifies
whether the first row or column in source contains category labels.
The source range must not be null. Use rowcol to specify whether the values are arranged by Rows or Columns.
Set categoryLabels to true if the first row or column in source contains category labels; otherwise, set it to false.
void Extend(IRange source, RowCol rowcol, bool categoryLabels)
Sub Extend(source As IRange, rowcol As RowCol, categoryLabels As Boolean)
| Type | Name | Description |
|---|---|---|
| IRange | source | The range that contains the data points to append to the existing series. |
| RowCol | rowcol | Specifies whether the values in |
| bool | categoryLabels |
true
if the first row or column in source contains category labels; otherwise, false.
|
worksheet.Range["A1:C3"].Value = new object[,] {
{"Month", "Sales", "Profit"},
{"Jan", 10, 4},
{"Feb", 12, 5}
};
worksheet.Range["A4:C5"].Value = new object[,] {
{"Mar", 15, 6},
{"Apr", 18, 7}
};
IChart chart = worksheet.Shapes.AddChart(ChartType.ColumnClustered, 20, 20, 360, 230).Chart;
chart.SeriesCollection.Add(worksheet.Range["A1:C3"], RowCol.Columns, true, true);
chart.SeriesCollection.Extend(worksheet.Range["A4:C5"], RowCol.Columns, false);