Class Sparkline

Class Sparkline

Namespace: Aspose.Cells.Charts
Assembly: Aspose.Cells.dll (25.2.0)

Một sparkline đại diện cho một biểu đồ hoặc đồ họa nhỏ trong một ô của bảng tính, cung cấp một đại diện hình ảnh của dữ liệu.

public class Sparkline

Kế thừa

objectSparkline

Các thành viên kế thừa

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Ví dụ

 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);

 // Định nghĩa 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("Phạm vi dữ liệu Sparkline: " + line.DataRange + ", hàng: " + line.Row + ", cột: " + line.Column);
 line.ToImage("output.png", new ImageOrPrintOptions());

Thuộc tính

Cột

Lấy chỉ số cột của sparkline.

public int Column { get; }

Giá trị thuộc tính

int

DataRange

Đại diện cho phạm vi dữ liệu của sparkline.

public string DataRange { get; set; }

Giá trị thuộc tính

string

Hàng

Lấy chỉ số hàng của sparkline.

public int Row { get; }

Giá trị thuộc tính

int

Phương thức

ToImage(string, ImageOrPrintOptions)

Chuyển đổi một sparkline thành hình ảnh.

public void ToImage(string fileName, ImageOrPrintOptions options)

Tham số

fileName string

Tên tệp hình ảnh.

options ImageOrPrintOptions

Các tùy chọn hình ảnh.

ToImage(Stream, ImageOrPrintOptions)

Chuyển đổi một sparkline thành hình ảnh.

public void ToImage(Stream stream, ImageOrPrintOptions options)

Tham số

stream Stream

Luồng hình ảnh.

options ImageOrPrintOptions

Các tùy chọn hình ảnh.

 Tiếng Việt