[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.Drawing.ISeriesCollection.Add

Add Method

Add(IRange)

Adds one or more new series to the ISeriesCollection collection.

This overload automatically determines whether each series is created from rows or columns in the source range.

Declaration
void Add(IRange source)
Sub Add(source As IRange)
Parameters
Type Name Description
IRange source

The range that provides the source data for the new series. Must not be null.

Examples
worksheet.Range["A1:C4"].Value = new object[,] {
    {"Month", "Sales", "Profit"},
    {"Jan", 100, 35},
    {"Feb", 120, 40},
    {"Mar", 140, 50}
};
IChart chart = worksheet.Shapes.AddChart(ChartType.ColumnClustered, 20, 20, 360, 220).Chart;
chart.SeriesCollection.Add(worksheet.Range["A1:C4"]);

Add(IRange, RowCol)

Adds one or more new series to the ISeriesCollection collection.

Use rowCol to specify whether each series is created from rows or columns in the source range.

Declaration
void Add(IRange source, RowCol rowCol)
Sub Add(source As IRange, rowCol As RowCol)
Parameters
Type Name Description
IRange source

The range that provides the source data for the new series. Must not be null.

RowCol rowCol

Specifies whether the source data is arranged by Rows or Columns. Must not be null.

Examples
worksheet.Range["A1:C4"].Value = new object[,] {
    {"Month", "Sales", "Profit"},
    {"Jan", 100, 35},
    {"Feb", 120, 40},
    {"Mar", 140, 50}
};
IChart chart = worksheet.Shapes.AddChart(ChartType.ColumnClustered, 20, 20, 360, 220).Chart;
chart.SeriesCollection.Add(worksheet.Range["A1:C4"], RowCol.Columns);

Add(IRange, RowCol, bool, bool)

Adds one or more series to this ISeriesCollection from the specified range.

Use rowCol to indicate whether each series is built from rows or columns in source. Use seriesLabels to indicate whether the first row or column contains series names, and use categoryLabels to indicate whether the first row or column contains category labels.

Declaration
void Add(IRange source, RowCol rowCol, bool seriesLabels, bool categoryLabels)
Sub Add(source As IRange, rowCol As RowCol, seriesLabels As Boolean, categoryLabels As Boolean)
Parameters
Type Name Description
IRange source

The range that provides the source data for the new series.

RowCol rowCol

Specifies whether the source data is arranged by Rows or Columns.

bool seriesLabels true if the first row or column in source contains series names; otherwise, false.
bool categoryLabels true if the first row or column in source contains category labels; otherwise, false.
Examples
worksheet.Range["A1:C4"].Value = new object[,] {
    {"Month", "Sales", "Profit"},
    {"Jan", 10, 4},
    {"Feb", 12, 5},
    {"Mar", 15, 6}
};
IChart chart = worksheet.Shapes.AddChart(ChartType.ColumnClustered, 20, 20, 360, 220).Chart;
chart.SeriesCollection.Add(worksheet.Range["A1:C4"], RowCol.Columns, true, true);