Class SparklineGroupCollection

SparklineGroupCollection class

Encapsulates a collection of SparklineGroup objects.

public class SparklineGroupCollection : CollectionBase<SparklineGroup>

Properties

NameDescription
Capacity { get; set; }
Count { get; }
Item { get; }Gets the SparklineGroup element at the specified index.
Item { get; set; }

Methods

NameDescription
Add(SparklineType)Adds an SparklineGroup with a Sparkline to the collection.
Add(SparklineType, string, bool, CellArea)Adds an SparklineGroup with Sparkline to the collection.
BinarySearch(SparklineGroup)
BinarySearch(SparklineGroup, IComparer<SparklineGroup>)
BinarySearch(int, int, SparklineGroup, IComparer<SparklineGroup>)
Clear()
ClearSparklineGroups(CellArea)Clears the sparkline groups that overlaps an area of cells.
ClearSparklines(CellArea)Clears the sparklines that is inside an area of cells.
Contains(SparklineGroup)
CopyTo(SparklineGroup[])
CopyTo(SparklineGroup[], int)
CopyTo(int, SparklineGroup[], int, int)
Exists(Predicate<SparklineGroup>)
Find(Predicate<SparklineGroup>)
FindAll(Predicate<SparklineGroup>)
FindIndex(Predicate<SparklineGroup>)
FindIndex(int, Predicate<SparklineGroup>)
FindIndex(int, int, Predicate<SparklineGroup>)
FindLast(Predicate<SparklineGroup>)
FindLastIndex(Predicate<SparklineGroup>)
FindLastIndex(int, Predicate<SparklineGroup>)
FindLastIndex(int, int, Predicate<SparklineGroup>)
GetEnumerator()
IndexOf(SparklineGroup)
IndexOf(SparklineGroup, int)
IndexOf(SparklineGroup, int, int)
LastIndexOf(SparklineGroup)
LastIndexOf(SparklineGroup, int)
LastIndexOf(SparklineGroup, int, int)
RemoveAt(int)

Examples

namespace AsposeCellsExamples
{
    using Aspose.Cells;
    using Aspose.Cells.Charts;
    using System;
    using System.Drawing;

    public class SparklineGroupCollectionDemo
    {
        public static void SparklineGroupCollectionExample()
        {
            // Create a new workbook
            Workbook workbook = new Workbook();
            Worksheet sheet = workbook.Worksheets[0];

            // Add some data to the worksheet
            sheet.Cells["A1"].PutValue(5);
            sheet.Cells["B1"].PutValue(2);
            sheet.Cells["C1"].PutValue(1);
            sheet.Cells["D1"].PutValue(3);

            // Define the CellArea for the sparkline
            CellArea ca = new CellArea
            {
                StartColumn = 4,
                EndColumn = 4,
                StartRow = 0,
                EndRow = 0
            };

            // Add a sparkline group to the worksheet
            int idx = sheet.SparklineGroups.Add(SparklineType.Line, "A1:D1", false, ca);
            SparklineGroup group = sheet.SparklineGroups[idx];

            // Add sparklines to the group
            group.Sparklines.Add(sheet.Name + "!A1:D1", 0, 5);

            // Customize the sparkline group
            group.ShowHighPoint = true;
            group.ShowLowPoint = true;
            group.HighPointColor.Color = Color.Green;
            group.LowPointColor.Color = Color.Red;
            group.LineWeight = 1.0;

            // Save the workbook
            workbook.Save("SparklineGroupCollectionExample.xlsx", SaveFormat.Xlsx);
        }
    }
}

See Also