aspose.cells

Class Sparkline

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

Property Getters/Setters Summary
functiongetColumn()
Gets the column index of the sparkline.
functiongetDataRange()
function
           Represents the data range of the sparkline.
functiongetRow()
Gets the row index of the sparkline.
 
Method Summary
functiontoImage(stream, options)
Converts a sparkline to an image.
functiontoImage(fileName, options)
Converts a sparkline to an image.
static functiontoImageStream(sparkline, stream, options)
Converts a sparkline to an image.
 

    • Property Getters/Setters Detail

      • getDataRange/setDataRange : String 

        function getDataRange() / function setDataRange(value)
        
        Represents the data range of the sparkline.
      • getRow : Number 

        function getRow()
        
        Gets the row index of the sparkline.
      • getColumn : Number 

        function getColumn()
        
        Gets the column index of the sparkline.
    • Method Detail

      • toImage

        function toImage(fileName, options)
        Converts a sparkline to an image.
        Parameters:
        fileName: String - The image file name.
        options: ImageOrPrintOptions - The image options
      • toImage

        function toImage(stream, options)
        Converts a sparkline to an image.
        Parameters:
        stream: OutputStream - The image stream.
        options: ImageOrPrintOptions - The image options.
      • toImageStream

        static function toImageStream(sparkline, stream, options)
        Converts a sparkline to an image.
        Parameters:
        sparkline: Sparkline - The Sparkline object
        stream: WritableStream - The stream of the output image
        options: ImageOrPrintOptions - Addtional 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);