[]
        
(Showing Draft Content)

IChartBars

Interface IChartBars


public interface IChartBars
Represents the up bars in a chart group.

Up bars connect the points in the first series to higher values in the last series of a line chart group. Obtain this interface from IChartGroup.getUpBars() after enabling up and down bars with IChartGroup.setHasUpDownBars(boolean).


 worksheet.getRange("A1:D6").setValue(new Object[][] {
     {null, "S1", "S2", "S3"},
     {"Item1", 10, 25, 25},
     {"Item2", -51, -36, 27},
     {"Item3", 52, -85, -30}
 });
 IShape shape = worksheet.getShapes().addChart(ChartType.Line, 200, 30, 300, 300);
 shape.getChart().getSeriesCollection().add(worksheet.getRange("A1:D6"), RowCol.Columns, true, true);
 shape.getChart().getLineGroups().get(0).setHasUpDownBars(true);
 IChartBars upBars = shape.getChart().getLineGroups().get(0).getUpBars();
 upBars.getFormat().getFill().getColor().setRGB(Color.GetGreen());
 
  • Method Details

    • getFormat

      IChartFormat getFormat()
      Gets the format of the chart bars.

      Use the returned IChartFormat object to access the fill and line formatting settings of the up bars or down bars in a line chart group.

      
       worksheet.getRange("A1:C4").setValue(new Object[][] {
           {"Month", "Planned", "Actual"},
           {"Jan", 10, 14},
           {"Feb", 18, 12},
           {"Mar", 15, 20}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.Line, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:C4"), RowCol.Columns, true, true);
       IChartGroup chartGroup = chart.getChartGroups().get(0);
       chartGroup.setHasUpDownBars(true);
       IChartFormat format = chartGroup.getUpBars().getFormat();
       
      Returns:
      The IChartFormat object for the chart bars.
    • getParent

      IChartGroup getParent()
      Gets the parent IChartGroup that contains these chart bars.

      Use this method to return to the chart group after accessing the up bars or down bars of a line chart.

      
       worksheet.getRange("A1:C4").setValue(new Object[][] {
           {"Month", "Planned", "Actual"},
           {"Jan", 10, 14},
           {"Feb", 18, 12},
           {"Mar", 15, 20}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.Line, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:C4"), RowCol.Columns, true, true);
       IChartGroup chartGroup = chart.getChartGroups().get(0);
       chartGroup.setHasUpDownBars(true);
       IChartBars upBars = chartGroup.getUpBars();
       IChartGroup parent = upBars.getParent();
       
      Returns:
      The parent IChartGroup that contains the chart bars.
    • delete

      void delete()
      Deletes this chart bars object.

      Use this method on an IChartBars instance returned by IChartGroup.getUpBars() or IChartGroup.getDownBars().

      
       worksheet.getRange("A1:C4").setValue(new Object[][] {
           {"Month", "Sales 2023", "Sales 2024"},
           {"Jan", 12, 18},
           {"Feb", 20, 15},
           {"Mar", 16, 22}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.Line, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:C4"), RowCol.Columns, true, true);
       IChartGroup chartGroup = chart.getChartGroups().get(0);
       chartGroup.setHasUpDownBars(true);
       chartGroup.getUpBars().delete();