ChartSeriesGroupCollection

ChartSeriesGroupCollection class

Represents a collection of ChartSeriesGroup objects.

public class ChartSeriesGroupCollection : IEnumerable<ChartSeriesGroup>

Properties

NameDescription
Count { get; }Returns the number of series groups in this collection.
Item { get; }Returns a ChartSeriesGroup at the specified index.

Methods

NameDescription
Add(ChartSeriesType)Adds a new series group of the specified series type to this collection.
GetEnumerator()Returns an enumerator object.
RemoveAt(int)Removes a series group at the specified index. All child series will be removed from the chart.

Remarks

To learn more, visit the Working with Charts documentation article.

Examples

Shows how to work with the secondary axis of chart.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

Shape shape = builder.InsertChart(ChartType.Line, 450, 250);
Chart chart = shape.Chart;
ChartSeriesCollection series = chart.Series;

// Delete default generated series.
series.Clear();

string[] categories = new string[] { "Category 1", "Category 2", "Category 3" };
series.Add("Series 1 of primary series group", categories, new double[] { 2, 3, 4 });
series.Add("Series 2 of primary series group", categories, new double[] { 5, 2, 3 });

// Create an additional series group, also of the line type.
ChartSeriesGroup newSeriesGroup = chart.SeriesGroups.Add(ChartSeriesType.Line);
// Specify the use of secondary axes for the new series group.
newSeriesGroup.AxisGroup = AxisGroup.Secondary;
// Hide the secondary X axis.
newSeriesGroup.AxisX.Hidden = true;
// Define title of the secondary Y axis.
newSeriesGroup.AxisY.Title.Show = true;
newSeriesGroup.AxisY.Title.Text = "Secondary Y axis";

// Add a series to the new series group.
ChartSeries series3 =
    newSeriesGroup.Series.Add("Series of secondary series group", categories, new double[] { 13, 11, 16 });
series3.Format.Stroke.Weight = 3.5;

doc.Save(ArtifactsDir + "Charts.SecondaryAxis.docx");

See Also