Class Sparklines
Represents the sparklines.The Sparklines object is a member of the SparklineGroup collection. The SparklineGroup collection contains all the Sparklines object of the worksheet.
Inheritance
Implements
Namespace: Syncfusion.XlsIO.Implementation
Assembly: Syncfusion.XlsIO.UWP.dll
Syntax
public class Sparklines : List<ISparkline>, ISparklines, IList<ISparkline>, ICollection<ISparkline>, IEnumerable<ISparkline>, IEnumerable
  Constructors
Sparklines()
Declaration
public Sparklines()
  Methods
Add()
Adds Sparkline instance.
Declaration
public Sparkline Add()
  Returns
| Type | Description | 
|---|---|
| Sparkline | the Saprkline object  | 
      
Examples
The following example demonstrates the Add method.
ExcelEngine engine=new ExcelEngine();
IApplication app= engine.Excel;
app.DefaultVersion= ExcelVersion.Excel2010;
IWorkbook wkBook= app.Workbooks.Create(2); 
IWorksheet sheet= wkBook.Worksheets[0];
ISparklineGroup spGroup= sheet.SparklineGroups.Add();
//Initialize the Saprklines
ISparklines sparklines=spGroup.Add(); 
//returns the sparkline object.
Sparkline sparkline=sparklines.Add();
wkBook.SaveAs("Sample.xlsx");
wkBook.Close();
  
  
  
  Add(IRange, IRange)
Adds the sparkline.
Declaration
public void Add(IRange dataRange, IRange referenceRange)
  Parameters
| Type | Name | Description | 
|---|---|---|
| IRange | dataRange | The data range.IRange  | 
      
| IRange | referenceRange | The reference range.IRange  | 
      
Examples
The following example demonstrates the Add method.
ExcelEngine engine=new ExcelEngine();
IApplication app= engine.Excel;
app.DefaultVersion= ExcelVersion.Excel2010;
IWorkbook wkBook= app.Workbooks.Create(2); 
IWorksheet sheet= wkBook.Worksheets[0];
ISparklineGroup spGroup= sheet.SparklineGroups.Add();
//Initialize the Sparklines
ISparklines sparklines=spGroup.Add(); 
//Add the Sparklines data range and reference range.
sparklines.Add(sheet.Range["A1:B2"],sheet.Range["C1"],true);
wkBook.SaveAs("Sample.xlsx");
wkBook.Close();
  
  
  
  Add(IRange, IRange, Boolean)
Adds the sparkline.
Declaration
public void Add(IRange dataRange, IRange referenceRange, bool isVertical)
  Parameters
| Type | Name | Description | 
|---|---|---|
| IRange | dataRange | The data range.IRange  | 
      
| IRange | referenceRange | The reference range.IRange  | 
      
| System.Boolean | isVertical | Specifies whether to plot the sparklines from the new data range by row or by column.  | 
      
Examples
The following example demonstrates the Add method.
ExcelEngine engine=new ExcelEngine();
IApplication app= engine.Excel;
app.DefaultVersion= ExcelVersion.Excel2010;
IWorkbook wkBook= app.Workbooks.Create(2); 
IWorksheet sheet= wkBook.Worksheets[0];
ISparklineGroup spGroup= sheet.SparklineGroups.Add();
//Initialize the Sparklines
ISparklines sparklines=spGroup.Add(); 
//Add the Sparklines data range and reference range.
sparklines.Add(sheet.Range["A1:B2"],sheet.Range["C1"],true);
wkBook.SaveAs("Sample.xlsx");
wkBook.Close();
  
  
  
  Clear(Sparkline)
Clears the sparkline.
Declaration
public void Clear(Sparkline sparkline)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Sparkline | sparkline | 
Examples
The following example demonstrates the Clear Method
ExcelEngine engine=new ExcelEngine();
IApplication app= engine.Excel;
app.DefaultVersion= ExcelVersion.Excel2010;
IWorkbook wkBook= app.Workbooks.Create(2); 
IWorksheet sheet= wkBook.Worksheets[0];
ISparklineGroup spGroup= sheet.SparklineGroups.Add();
//Initialize the Saprklines
ISparklines sparklines=spGroup.Add(); 
//Clears the Sparkline from the specified range.
sparklines.Clear(sparklines[0] as Sparkline);
wkBook.SaveAs("Sample.xlsx");
wkBook.Close();
  
  
  
  RefreshRanges(IRange, IRange)
Adds the sparkline.
Declaration
public void RefreshRanges(IRange dataRange, IRange referenceRange)
  Parameters
| Type | Name | Description | 
|---|---|---|
| IRange | dataRange | The data range.IRange  | 
      
| IRange | referenceRange | The reference range.IRange  | 
      
Examples
The following example demonstrates the Add method.
ExcelEngine engine=new ExcelEngine();
IApplication app= engine.Excel;
app.DefaultVersion= ExcelVersion.Excel2010;
IWorkbook wkBook= app.Workbooks.Create(2); 
IWorksheet sheet= wkBook.Worksheets[0];
ISparklineGroup spGroup= sheet.SparklineGroups[0];
//Initialize the Sparklines
ISparklines sparklines=spGroup[0]; 
//Add the Sparklines data range and reference range.
sparklines.RefreshRanges(sheet.Range["A1:B2"],sheet.Range["C1"]);
wkBook.SaveAs("Sample.xlsx");
wkBook.Close();
  
  
  
  RefreshRanges(IRange, IRange, Boolean)
Adds the sparkline.
Declaration
public void RefreshRanges(IRange dataRange, IRange referenceRange, bool isVertical)
  Parameters
| Type | Name | Description | 
|---|---|---|
| IRange | dataRange | The data range.IRange  | 
      
| IRange | referenceRange | The reference range.IRange  | 
      
| System.Boolean | isVertical | 
Examples
The following example demonstrates the Add method.
ExcelEngine engine=new ExcelEngine();
IApplication app= engine.Excel;
app.DefaultVersion= ExcelVersion.Excel2010;
IWorkbook wkBook= app.Workbooks.Create(2); 
IWorksheet sheet= wkBook.Worksheets[0];
ISparklineGroup spGroup= sheet.SparklineGroups[0];
//Initialize the Sparklines
ISparklines sparklines=spGroup[0]; 
//Add the Sparklines data range and reference range.
sparklines.RefreshRanges(sheet.Range["A1:B2"],sheet.Range["C1"],true);
wkBook.SaveAs("Sample.xlsx");
wkBook.Close();