Sparkline

Inheritance: java.lang.Object

public class Sparkline

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

Example

         Workbook book = new Workbook(); 
         Worksheet sheet = book.getWorksheets().get(0);
 
         sheet.getCells().get("A1").putValue(5);
         sheet.getCells().get("B1").putValue(2);
         sheet.getCells().get("C1").putValue(1);
         sheet.getCells().get("D1").putValue(3);
 
         // Define the CellArea
         CellArea ca = new CellArea();
         ca.StartColumn = 4;
         ca.EndColumn = 4;
         ca.StartRow = 0;
         ca.EndRow = 0;
 
         int idx = sheet.getSparklineGroups().add(com.aspose.cells.SparklineType.LINE, sheet.getName() + "!A1:D1", false, ca);
 
         SparklineGroup group = sheet.getSparklineGroups().get(idx);
         idx = group.getSparklines().add(sheet.getName() + "!A1:D1", 0, 4);
         Sparkline line = group.getSparklines().get(idx);
         System.out.println("Saprkline data range: " + line.getDataRange() + ", row: " + line.getRow() + ", column: " + line.getColumn());
         line.toImage("output.png", new ImageOrPrintOptions());

Methods

MethodDescription
equals(Object arg0)
getClass()
getColumn()Gets the column index of the sparkline.
getDataRange()Represents the data range of the sparkline.
getRow()Gets the row index of the sparkline.
hashCode()
notify()
notifyAll()
setDataRange(String value)Represents the data range of the sparkline.
toImage(OutputStream stream, ImageOrPrintOptions options)Converts a sparkline to an image.
toImage(String fileName, ImageOrPrintOptions options)Converts a sparkline to an image.
toString()
wait()
wait(long arg0)
wait(long arg0, int arg1)

equals(Object arg0)

public boolean equals(Object arg0)

Parameters:

ParameterTypeDescription
arg0java.lang.Object

Returns: boolean

getClass()

public final native Class<?> getClass()

Returns: java.lang.Class

getColumn()

public int getColumn()

Gets the column index of the sparkline.

Returns: int

getDataRange()

public String getDataRange()

Represents the data range of the sparkline.

Returns: java.lang.String

getRow()

public int getRow()

Gets the row index of the sparkline.

Returns: int

hashCode()

public native int hashCode()

Returns: int

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

setDataRange(String value)

public void setDataRange(String value)

Represents the data range of the sparkline.

Parameters:

ParameterTypeDescription
valuejava.lang.String

toImage(OutputStream stream, ImageOrPrintOptions options)

public void toImage(OutputStream stream, ImageOrPrintOptions options)

Converts a sparkline to an image.

Parameters:

ParameterTypeDescription
streamjava.io.OutputStreamThe image stream.
optionsImageOrPrintOptionsThe image options.

toImage(String fileName, ImageOrPrintOptions options)

public void toImage(String fileName, ImageOrPrintOptions options)

Converts a sparkline to an image.

Parameters:

ParameterTypeDescription
fileNamejava.lang.StringThe image file name.
optionsImageOrPrintOptionsThe image options

toString()

public String toString()

Returns: java.lang.String

wait()

public final void wait()

wait(long arg0)

public final native void wait(long arg0)

Parameters:

ParameterTypeDescription
arg0long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

Parameters:

ParameterTypeDescription
arg0long
arg1int