[]
        
(Showing Draft Content)

ISparkLineObject

Interface ISparkLineObject


public interface ISparkLineObject
Represents a single sparkline object.

This interface provides access to a sparkline value stored in a worksheet cell. Use toJson() to obtain the JSON representation of the current sparkline.


 worksheet.getRange("A1").setFormula("=LINESPARKLINE({1,2,8,4,5,6},1)");
 ISparkLineObject sparkLineObject = (ISparkLineObject) worksheet.getRange("A1").getValue();
 String json = sparkLineObject.toJson();
 
  • Method Summary

    Modifier and Type
    Method
    Description
    Obtains the JSON string of the current Sparkline.
  • Method Details

    • toJson

      String toJson()
      Obtains the JSON string of the current Sparkline.

      If a cell contains a sparkline formula, calling IRange.getValue() returns an ISparkLineObject that can be serialized to JSON by using this method.

      
       worksheet.getRange("B1:E1").setValue(new Object[] {1, 3, 2, 4});
       worksheet.getRange("F1").setFormula("=LINESPARKLINE(B1:E1,1)");
       ISparkLineObject sparkline = (ISparkLineObject) worksheet.getRange("F1").getValue();
       String json = sparkline.toJson();
       
      Returns:
      The JSON string corresponding to the current Sparkline.