Class Sparkline
Class Sparkline
Namespace: Aspose.Cells.Charts
Assembly: Aspose.Cells.dll (25.2.0)
A sparkline represents a tiny chart or graphic in a worksheet cell that provides a visual representation of data.
public class Sparkline
Inheritance
Inherited Members
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Examples
csharp
[C#]
Workbook book = new Workbook();
Worksheet sheet = book.Worksheets[0];
sheet.Cells["A1"].PutValue(5);
sheet.Cells["B1"].PutValue(2);
sheet.Cells["C1"].PutValue(1);
sheet.Cells["D1"].PutValue(3);
// Define the CellArea
CellArea ca = new CellArea();
ca.StartColumn = 4;
ca.EndColumn = 4;
ca.StartRow = 0;
ca.EndRow = 0;
int idx = sheet.SparklineGroups.Add(Aspose.Cells.Charts.SparklineType.Line, sheet.Name + "!A1:D1", false, ca);
SparklineGroup group = sheet.SparklineGroups[idx];
idx = group.Sparklines.Add(sheet.Name + "!A1:D1", 0, 4);
Sparkline line = group.Sparklines[idx];
Console.WriteLine("Saprkline data range: " + line.DataRange + ", row: " + line.Row + ", column: " + line.Column);
line.ToImage("output.png", new ImageOrPrintOptions());
Properties
Column
Gets the column index of the sparkline.
public int Column { get; }
Property Value
DataRange
Represents the data range of the sparkline.
public string DataRange { get; set; }
Property Value
Row
Gets the row index of the sparkline.
public int Row { get; }
Property Value
Methods
ToImage(string, ImageOrPrintOptions)
Converts a sparkline to an image.
public void ToImage(string fileName, ImageOrPrintOptions options)
Parameters
fileName
string
The image file name.
options
ImageOrPrintOptions
The image options
ToImage(Stream, ImageOrPrintOptions)
Converts a sparkline to an image.
public void ToImage(Stream stream, ImageOrPrintOptions options)
Parameters
stream
Stream
The image stream.
options
ImageOrPrintOptions
The image options.