Class Sparkline
Class Sparkline
Namespace: Aspose.Cells.Charts
Assembly: Aspose.Cells.dll (25.2.0)
Sebuah sparkline mewakili grafik kecil atau grafik dalam sel worksheet yang memberikan representasi visual dari data.
public class Sparkline
Pewarisan
Anggota yang Dwarisi
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Contoh
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);
// Definisikan 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("Rentang data sparkline: " + line.DataRange + ", baris: " + line.Row + ", kolom: " + line.Column);
line.ToImage("output.png", new ImageOrPrintOptions());
Properti
Kolom
Mengambil indeks kolom dari sparkline.
public int Column { get; }
Nilai Properti
DataRange
Mewakili rentang data dari sparkline.
public string DataRange { get; set; }
Nilai Properti
Baris
Mengambil indeks baris dari sparkline.
public int Row { get; }
Nilai Properti
Metode
ToImage(string, ImageOrPrintOptions)
Mengonversi sparkline menjadi gambar.
public void ToImage(string fileName, ImageOrPrintOptions options)
Parameter
fileName
string
Nama file gambar.
options
ImageOrPrintOptions
Opsi gambar
ToImage(Stream, ImageOrPrintOptions)
Mengonversi sparkline menjadi gambar.
public void ToImage(Stream stream, ImageOrPrintOptions options)
Parameter
stream
Stream
Aliran gambar.
options
ImageOrPrintOptions
Opsi gambar.