Class Sparkline

Class Sparkline

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

火花线表示工作表单元格中的一个小图表或图形,用于提供数据的可视化表示。

public class Sparkline

继承

objectSparkline

继承成员

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

示例

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

 // 定义 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("火花线数据范围: " + line.DataRange + ", 行: " + line.Row + ", 列: " + line.Column);
 line.ToImage("output.png", new ImageOrPrintOptions());

属性

获取火花线的列索引。

public int Column { get; }

属性值

int

数据范围

表示火花线的数据范围。

public string DataRange { get; set; }

属性值

string

获取火花线的行索引。

public int Row { get; }

属性值

int

方法

ToImage(string, ImageOrPrintOptions)

将火花线转换为图像。

public void ToImage(string fileName, ImageOrPrintOptions options)

参数

fileName string

图像文件名。

options ImageOrPrintOptions

图像选项

ToImage(Stream, ImageOrPrintOptions)

将火花线转换为图像。

public void ToImage(Stream stream, ImageOrPrintOptions options)

参数

stream Stream

图像流。

options ImageOrPrintOptions

图像选项。

 中文