Sparkline

Sparkline class

A sparkline represents a tiny chart or graphic in a worksheet cell that provides a visual representation of data.

Methods

NameDescription
getColumn()Gets the column index of the sparkline.
getDataRange()Represents the data range of the sparkline.
getRow()Gets the row index of the sparkline.
setDataRange()Represents the data range of the sparkline.
toImage(fileName, options)Converts a sparkline to an image.
toImage(stream, options)Converts a sparkline to an image.
toImageStream(sparkline, stream, options) (static)Converts a sparkline to an image.

getColumn()

Gets the column index of the sparkline.

getDataRange()

Represents the data range of the sparkline.

getRow()

Gets the row index of the sparkline.

setDataRange()

Represents the data range of the sparkline.

toImage(fileName, options)

Converts a sparkline to an image.

ParameterTypeDescription
fileNameStringThe image file name.
optionsImageOrPrintOptionsThe image options

toImage(stream, options)

Converts a sparkline to an image.

ParameterTypeDescription
streamOutputStreamThe image stream.
optionsImageOrPrintOptionsThe image options.

toImageStream(sparkline, stream, options) (static)

Converts a sparkline to an image.

ParameterTypeDescription
sparklineSparklineThe Sparkline object
streamWritableStreamThe stream of the output image
optionsImageOrPrintOptionsAddtional image creation options

Example:

var aspose = aspose || {};
aspose.cells = require("aspose.cells");
var fs = require("fs");
var workbook = new aspose.cells.Workbook("sparkline.xlsx");
var sparkline = workbook.getWorksheets().get(0).getSparklineGroupCollection().get(0).getSparklineCollection().get(0);
var imgWriteStream = fs.createWriteStream("sparkline.jpeg");
var imgOptions = new aspose.cells.ImageOrPrintOptions();
imgOptions.setHorizontalResolution(200);
imgOptions.setVerticalResolution(300);
imgOptions.setImageFormat(aspose.cells.ImageFormat.getJpeg());
aspose.cells.Sparkline.toImageStream(sparkline, imgWriteStream, imgOptions);