[]
        
(Showing Draft Content)

ISparklineGroups

Interface ISparklineGroups

All Superinterfaces:
Iterable<ISparklineGroup>

public interface ISparklineGroups extends Iterable<ISparklineGroup>
Represents a collection of sparkline groups.

An ISparklineGroups object is associated with an IRange and provides access to the sparkline groups in that range. Use this interface to add new sparkline groups, retrieve existing groups, clear sparklines, group selected sparklines, and iterate through the collection.


 Object[][] data = new Object[][] {
     {1, 2, 3},
     {4, 5, 6},
     {7, 8, 9},
     {10, 11, 12}
 };
 worksheet.getRange("A1:C4").setValue(data);
 ISparklineGroups sparklineGroups = worksheet.getRange("D1:D4").getSparklineGroups();
 sparklineGroups.add(SparkType.Line, "A1:C4");
 ISparklineGroup sparklineGroup = sparklineGroups.get(0);
 
  • Method Details

    • getCount

      int getCount()
      Gets the number of sparkline groups in the associated IRange object.

      Use this method to determine how many sparkline groups are contained in the range before accessing individual groups.

      
       IRange range = worksheet.getRange("A1:A3");
       worksheet.getRange("B1:B3").setValue(new Object[] {1, 3, 2});
       range.getSparklineGroups().add(SparkType.Line, "B1:B3");
       int count = range.getSparklineGroups().getCount();
       
      Returns:
      The number of sparkline groups in the associated range.
    • get

      ISparklineGroup get(int index)
      Returns the ISparklineGroup object from a collection.

      Use this method to retrieve an existing sparkline group by its position in the current ISparklineGroups collection.

      
       worksheet.getRange("A1:C4").setValue(new Object[][] {
           {1, 2, 3},
           {4, 5, 6},
           {7, 8, 9},
           {10, 11, 12}
       });
       worksheet.getRange("D1:D4").getSparklineGroups().add(SparkType.Line, "A1:C4");
       ISparklineGroup sparklineGroup = worksheet.getRange("D1:D4").getSparklineGroups().get(0);
       
      Parameters:
      index - Specifies the position of an element in the collection.
      Returns:
      The ISparklineGroup object at the specified position in the collection.
    • add

      ISparklineGroup add(SparkType type, String sourceData)
      Creates a new sparkline group and returns an ISparklineGroup object.

      Use this method to create sparklines in the current ISparklineGroups collection from the specified source data range.

      
       worksheet.getRange("A1:C4").setValue(new Object[][] {
           {1, 2, 3},
           {4, 5, 6},
           {7, 8, 9},
           {10, 11, 12}
       });
       ISparklineGroup sparklineGroup = worksheet.getRange("D1:D4").getSparklineGroups().add(SparkType.Line, "A1:C4");
       
      Parameters:
      type - The type of sparkline.
      sourceData - The range reference string to use as the source data for the sparkline group.
      Returns:
      The newly created ISparklineGroup object.
    • clear

      void clear()
      Clears the selected sparklines.

      Removes the sparkline objects from the cells in the associated range without clearing the underlying worksheet data. To remove entire sparkline groups, use clearGroups() instead.

      
       Object[][] data = new Object[][] {
           {1, 2, 3},
           {4, 5, 6}
       };
       worksheet.getRange("A1:C2").setValue(data);
       worksheet.getRange("D1:D2").getSparklineGroups().add(SparkType.Line, "A1:C2");
       worksheet.getRange("D1").getSparklineGroups().clear();
       
    • clearGroups

      void clearGroups()
      Clears the selected sparkline groups.

      Removes the sparkline groups associated with the selected cells. Unlike clear(), this method removes entire sparkline groups rather than only clearing individual sparkline objects from the selected cells.

      
       worksheet.getRange("A1:B2").setValue(new Object[][] {
           {1, 2},
           {3, 4}
       });
       worksheet.getRange("D1:D2").getSparklineGroups().add(SparkType.Line, "A1:B2");
       worksheet.getRange("D1").getSparklineGroups().clearGroups();
       
    • group

      void group()
      Groups the selected sparklines.

      Use this method to combine existing sparklines in the associated range into a sparkline group so they share the same group settings.

      
       IRange range = worksheet.getRange("A1:A3");
       worksheet.getRange("B1:B3").setValue(new Object[] {1, 3, 2});
       range.getSparklineGroups().add(SparkType.Line, "B1:B3");
       worksheet.getRange("D1:D3").setValue(new Object[] {2, 4, 1});
       worksheet.getRange("E1:E3").getSparklineGroups().add(SparkType.Line, "D1:D3");
       worksheet.getRange("A1:E3").getSparklineGroups().group();
       
    • group

      void group(IRange Location)
      Groups the selected sparklines.

      The grouped sparklines are based on the sparkline at the specified location. If Location is null, the group is based on the first sparkline in the collection.

      
       Object[][] data = new Object[][] {
           {1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12}
       };
       worksheet.getRange("A1:C4").setValue(data);
       worksheet.getRange("D1:D4").getSparklineGroups().add(SparkType.Line, "A1:C4");
       worksheet.getRange("F1:H4").setValue(data);
       worksheet.getRange("J1:J4").getSparklineGroups().add(SparkType.Column, "F1:H4");
       worksheet.getRange("A1:J4").getSparklineGroups().group(worksheet.getRange("J2"));
       
      Parameters:
      Location - The range that specifies which sparkline the new group is based on. If null, the group is based on the first sparkline in the collection.
    • ungroup

      void ungroup()
      Ungroups the sparklines in the selected sparkline group.

      Use this method on the ISparklineGroups collection associated with the sparkline cells to remove the current grouping of those sparklines.

      
       IRange range = worksheet.getRange("A1:A3");
       worksheet.getRange("B1:B3").setValue(new Object[] {1, 3, 2});
       range.getSparklineGroups().add(SparkType.Line, "B1:B3");
       range.getSparklineGroups().ungroup();