[]
        
(Showing Draft Content)

IChart

Interface IChart


public interface IChart
Represents a chart object in a worksheet.

An IChart provides access to the chart's data series, axes, title, legend, plot area, and chart type so you can create and configure charts that are hosted by worksheet shapes.


 worksheet.getRange("A1:B3").setValue(new Object[][] {
     {"Month", "Sales"},
     {"Jan", 100},
     {"Feb", 120}
 });
 IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
 chart.getSeriesCollection().add(worksheet.getRange("A1:B3"), RowCol.Columns, true, true);
 
  • Method Details

    • getName

      String getName()
      Gets the name of the chart object.

      The returned value is the object name assigned to the chart.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       String name = chart.getName();
       
      Returns:
      The name of the chart object.
    • getParent

      IShape getParent()
      Gets the parent IShape that contains the chart.

      Use this method to access the shape object that hosts the chart, such as when you need to work with the chart through the worksheet's shape collection.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       IShape parent = chart.getParent();
       
      Returns:
      The parent IShape of the chart.
    • getChartType

      ChartType getChartType()
      Gets the type of the chart.

      The returned ChartType value identifies the current chart type, such as column, line, pie, or 3-D chart types.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       ChartType chartType = chart.getChartType();
       
      Returns:
      The current ChartType of the chart.
    • setChartType

      void setChartType(ChartType value)
      Sets the chart type.

      Use this method to change an existing chart to another ChartType.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.setChartType(ChartType.Line);
       
      Parameters:
      value - The ChartType to apply to the chart.
    • getSeriesCollection

      ISeriesCollection getSeriesCollection()
      Gets the collection of all series in the chart.

      Use the returned ISeriesCollection object to access, add, or modify the series contained in the chart.

      
       worksheet.getRange("A1:B3").setValue(new Object[][] {
           {"Month", "Sales"},
           {"Jan", 100},
           {"Feb", 120}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B3"));
       ISeriesCollection seriesCollection = chart.getSeriesCollection();
       
      Returns:
      The collection of all series in the chart.
    • getAxes

      IAxes getAxes()
      Gets the collection of axes on the chart.

      Use the returned IAxes object to access the chart's category, value, or series axes, such as by calling IAxes.item(AxisType,AxisGroup).

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       IAxes axes = chart.getAxes();
       IAxis categoryAxis = axes.item(AxisType.Category, AxisGroup.Primary);
       
      Returns:
      The IAxes collection that contains the axes of the chart.
    • getChartArea

      IChartArea getChartArea()
      Gets the IChartArea object that represents the complete chart area of the chart.

      The chart area contains the chart elements outside the plotted data region, such as the chart title and legend. For the area where data is plotted, see getPlotArea().

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       IChartArea chartArea = chart.getChartArea();
       chartArea.getFormat().getFill().getColor().setRGB(Color.GetRed());
       
      Returns:
      The IChartArea object that represents the complete chart area of the chart.
    • getChartTitle

      IChartTitle getChartTitle()
      Gets the IChartTitle object that represents the title of the chart.

      Use the returned title object to read or modify chart title properties, such as the title text and formatting.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getChartTitle().setText("Sales Analysis");
       IChartTitle title = chart.getChartTitle();
       
      Returns:
      The IChartTitle object that represents the title of the chart.
    • getPlotArea

      IPlotArea getPlotArea()
      Gets the plot area of the chart.

      The plot area is the region where the chart data series are drawn.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       IPlotArea plotArea = chart.getPlotArea();
       IChartFormat format = plotArea.getFormat();
       
      Returns:
      The IPlotArea object that represents the plot area of the chart.
    • getLegend

      ILegend getLegend()
      Gets the legend for the chart.

      Use the returned ILegend object to configure legend settings such as position, font, and formatting. To control whether the legend is displayed, use setHasLegend(boolean).

      
       worksheet.getRange("A1:C3").setValue(new Object[][] {
           {"Month", "Q1", "Q2"},
           {"Jan", 10, 20},
           {"Feb", 15, 25}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:C3"), RowCol.Columns, true, true);
       chart.setHasLegend(true);
       ILegend legend = chart.getLegend();
       legend.setPosition(LegendPosition.Left);
       
      Returns:
      The ILegend object that represents the legend for the chart.
    • getDataTable

      IDataTable getDataTable()
      Gets the IDataTable object that represents the chart data table.

      Use the returned IDataTable object to access the formatting and display settings of the chart data table. To display a data table for the chart, set setHasDataTable(boolean) to true before using this method.

      
       worksheet.getRange("A1:C3").setValue(new Object[][] {
           {"Item", "Estimated", "Actual"},
           {"Income", 63300, 57450},
           {"Expenses", 54500, 49630}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:C3"));
       chart.setHasDataTable(true);
       IDataTable dataTable = chart.getDataTable();
       
      Returns:
      The IDataTable object that represents the chart data table.
    • getFloor

      IFloor getFloor()
      Gets the IFloor object that represents the floor of a 3-D chart.

      Use this property to access floor-specific formatting and thickness settings for a 3-D chart.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered3D, 20, 20, 300, 200).getChart();
       IFloor floor = chart.getFloor();
       floor.setThickness(120);
       
      Returns:
      The IFloor object that represents the floor of the 3-D chart.
    • getWalls

      IWall getWalls()
      Gets the IWall object that represents the walls of a 3-D chart.

      Use this method to access wall formatting that applies to the chart walls as a whole. To format the side wall or back wall individually, use getSideWall() or getBackWall().

      
       worksheet.getRange("A1:B3").setValue(new Object[][] {
           {"Name", "Value"},
           {"A", 10},
           {"B", 20}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.Column3D, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B3"), RowCol.Columns, true, true);
       IWall walls = chart.getWalls();
       walls.setThickness(20);
       
      Returns:
      The IWall object that represents the walls of the 3-D chart.
    • getSideWall

      IWall getSideWall()
      Gets the IWall object that allows individual formatting of the side wall of a 3-D chart.

      Use the returned wall to configure side-wall properties such as thickness, fill, and line formatting.

      
       worksheet.getRange("A1:B3").setValue(new Object[][] {
           {"Name", "Value"},
           {"A", 100},
           {"B", 200}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.Column3D, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B3"), RowCol.Columns, true, true);
       IWall sideWall = chart.getSideWall();
       sideWall.setThickness(20);
       
      Returns:
      The IWall object for the side wall of the 3-D chart.
    • getBackWall

      IWall getBackWall()
      Gets the IWall object that allows you to individually format the back wall of a 3-D chart.

      Use the returned IWall to configure properties such as the back wall's fill, line, and thickness.

      
       worksheet.getRange("A1:B3").setValue(new Object[][] {
           {"Quarter", "Sales"},
           {"Q1", 100},
           {"Q2", 200}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered3D, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B3"), RowCol.Columns, true, true);
       IWall backWall = chart.getBackWall();
       backWall.getFormat().getFill().getColor().setRGB(Color.GetRed());
       
      Returns:
      The IWall object that represents the back wall of the 3-D chart.
    • getAutoScaling

      boolean getAutoScaling()
      Gets whether a 3-D chart is automatically scaled to be closer in size to the corresponding 2-D chart.

      This property applies when getRightAngleAxes() is true.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered3D, 20, 20, 300, 200).getChart();
       chart.setRightAngleAxes(true);
       chart.setAutoScaling(true);
       boolean autoScaling = chart.getAutoScaling();
       
      Returns:
      true if the 3-D chart is automatically scaled to be closer in size to the corresponding 2-D chart; otherwise, false.
    • setAutoScaling

      void setAutoScaling(boolean value)
      Sets whether a 3-D chart is automatically scaled to be closer in size to the corresponding 2-D chart.

      This property applies when getRightAngleAxes() is true.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered3D, 20, 20, 300, 200).getChart();
       chart.setRightAngleAxes(true);
       chart.setAutoScaling(true);
       
      Parameters:
      value - true if the 3-D chart is automatically scaled to be closer in size to the corresponding 2-D chart; otherwise, false.
    • getBarShape

      BarShape getBarShape()
      Gets the shape used with the 3-D bar or column chart.

      Use this property to determine which BarShape is applied to a 3-D bar or 3-D column chart.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered3D, 20, 20, 300, 200).getChart();
       chart.setBarShape(BarShape.Cylinder);
       BarShape barShape = chart.getBarShape();
       
      Returns:
      The BarShape used by the 3-D bar or column chart.
    • setBarShape

      void setBarShape(BarShape value)
      Sets the shape used with the 3-D bar or column chart.

      Use this property to control how bars or columns are rendered in a 3-D bar or 3-D column chart.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered3D, 20, 20, 300, 200).getChart();
       chart.setBarShape(BarShape.Cylinder);
       
      Parameters:
      value - The BarShape to apply to the 3-D bar or column chart.
    • getPlotVisibleOnly

      boolean getPlotVisibleOnly()
      Gets whether the chart plots only visible cells.

      If this property is true, the chart plots data from visible cells only. If this property is false, the chart plots data from both visible and hidden cells.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.setPlotVisibleOnly(false);
       boolean plotVisibleOnly = chart.getPlotVisibleOnly();
       
      Returns:
      true if the chart plots only visible cells; otherwise, false.
    • setPlotVisibleOnly

      void setPlotVisibleOnly(boolean value)
      Sets whether the chart plots only visible cells.

      If this property is true, the chart plots data from visible cells only. If this property is false, the chart plots data from both visible and hidden cells.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.setPlotVisibleOnly(false);
       
      Parameters:
      value - true if the chart plots only visible cells; otherwise, false.
    • getDisplayNaAsBlank

      boolean getDisplayNaAsBlank()
      Gets whether the chart displays #N/A values as empty cells.

      If this property is true, data points whose values evaluate to #N/A are displayed as blank cells in the chart.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.setDisplayNaAsBlank(true);
       boolean displayNaAsBlank = chart.getDisplayNaAsBlank();
       
      Returns:
      true if the chart displays #N/A values as empty cells; otherwise, false.
    • setDisplayNaAsBlank

      void setDisplayNaAsBlank(boolean value)
      Sets whether the chart displays #N/A values as empty cells.

      If this property is true, data points whose values evaluate to #N/A are displayed as blank cells in the chart.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.setDisplayNaAsBlank(true);
       
      Parameters:
      value - true if the chart displays #N/A values as empty cells; otherwise, false.
    • getDepthPercent

      int getDepthPercent()
      Gets the depth of a 3-D chart as a percentage of the chart width.

      This property applies to 3-D charts. The returned value is between 20 and 2000 percent.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.Column3D, 20, 20, 300, 200).getChart();
       chart.setDepthPercent(150);
       int depthPercent = chart.getDepthPercent();
       
      Returns:
      The depth of the 3-D chart, expressed as a percentage of the chart width.
    • setDepthPercent

      void setDepthPercent(int value)
      Sets the depth of a 3-D chart as a percentage of the chart width.

      This property applies to 3-D charts. The value must be between 20 and 2000 percent.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.Column3D, 20, 20, 300, 200).getChart();
       chart.setDepthPercent(150);
       
      Parameters:
      value - The depth of the 3-D chart, expressed as a percentage of the chart width.
    • getDisplayBlanksAs

      DisplayBlanksAs getDisplayBlanksAs()
      Gets the way that blank cells are plotted on the chart.

      The returned value specifies whether blank cells are not plotted, interpolated, or plotted as zero by using DisplayBlanksAs constants.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.Line, 20, 20, 300, 200).getChart();
       chart.setDisplayBlanksAs(DisplayBlanksAs.Interpolated);
       DisplayBlanksAs displayBlanksAs = chart.getDisplayBlanksAs();
       
      Returns:
      A DisplayBlanksAs value that indicates how blank cells are plotted on the chart.
    • setDisplayBlanksAs

      void setDisplayBlanksAs(DisplayBlanksAs value)
      Sets how blank cells are plotted on the chart.

      Use this property to control whether blank values in the chart source range are displayed as gaps, connected by interpolation, or plotted as zero by using DisplayBlanksAs constants.

      
       IRange range = worksheet.getRange("A1:B4");
       range.setValue(new Object[][] {{"Month", "Sales"}, {"Jan", 10}, {"Feb", null}, {"Mar", 14}});
       IChart chart = worksheet.getShapes().addChart(ChartType.Line, 20, 20, 300, 200).getChart();
       chart.setSourceData(range);
       chart.setDisplayBlanksAs(DisplayBlanksAs.Interpolated);
       
      Parameters:
      value - The blank cell plotting mode. Use DisplayBlanksAs.NotPlotted, DisplayBlanksAs.Interpolated, or DisplayBlanksAs.Zero.
    • getElevation

      double getElevation()
      Gets the elevation of the 3-D chart view in degrees.

      Use this property to retrieve the current vertical viewing angle applied to a 3-D chart.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered3D, 20, 20, 300, 200).getChart();
       chart.setElevation(25);
       double elevation = chart.getElevation();
       
      Returns:
      The elevation of the 3-D chart view, in degrees.
    • setElevation

      void setElevation(double value)
      Sets the elevation of the 3-D chart view in degrees.

      Use this property to set the vertical viewing angle applied to a 3-D chart.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered3D, 20, 20, 300, 200).getChart();
       chart.setElevation(25);
       
      Parameters:
      value - The elevation of the 3-D chart view, in degrees.
    • getGapDepth

      int getGapDepth()
      Gets the distance between the data series in a 3-D chart as a percentage of the marker width.

      This property applies to 3-D charts. The returned value is in the range from 0 to 500.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered3D, 20, 20, 300, 200).getChart();
       chart.setGapDepth(200);
       int gapDepth = chart.getGapDepth();
       
      Returns:
      The distance between the data series in a 3-D chart, as a percentage of the marker width.
    • setGapDepth

      void setGapDepth(int value)
      Sets the distance between the data series in a 3-D chart as a percentage of the marker width.

      This property applies to 3-D charts. The value must be in the range from 0 to 500.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered3D, 20, 20, 300, 200).getChart();
       chart.setGapDepth(200);
       
      Parameters:
      value - The distance between the data series in a 3-D chart, as a percentage of the marker width.
    • getHasLegend

      boolean getHasLegend()
      Gets whether the chart has a legend.

      Use this property to determine whether the legend is currently displayed for the chart.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.setHasLegend(true);
       boolean hasLegend = chart.getHasLegend();
       
      Returns:
      true if the chart has a legend; otherwise, false.
    • setHasLegend

      void setHasLegend(boolean value)
      Sets whether the chart has a legend.

      Set this property to true to show the legend, or false to hide it.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.setHasLegend(true);
       
      Parameters:
      value - true if the chart has a legend; otherwise, false.
    • getHasDataTable

      boolean getHasDataTable()
      Gets a value indicating whether the chart displays a data table.

      Use setHasDataTable(boolean) to show or hide the data table for a chart. For chart types that do not support data tables, this method returns false.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.setHasDataTable(true);
       boolean hasDataTable = chart.getHasDataTable();
       
      Returns:
      true if the chart displays a data table; otherwise, false.
    • setHasDataTable

      void setHasDataTable(boolean value)
      Sets a value indicating whether the chart displays a data table.
      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.setHasDataTable(true);
       
      Parameters:
      value - true if the chart displays a data table; otherwise, false.
    • getHasTitle

      boolean getHasTitle()
      Gets whether the chart has a visible title.

      This property indicates whether the chart title is displayed.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.setHasTitle(true);
       boolean hasTitle = chart.getHasTitle();
       
      Returns:
      true if the chart has a visible title; otherwise, false.
    • setHasTitle

      void setHasTitle(boolean value)
      Sets whether the chart has a visible title.

      Set this property to true to show the chart title, or false to hide it.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.setHasTitle(true);
       
      Parameters:
      value - true if the chart has a visible title; otherwise, false.
    • getHeightPercent

      int getHeightPercent()
      Gets the height of a 3-D chart as a percentage of the chart width.

      The returned value is between 5 and 500 percent.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered3D, 20, 20, 300, 200).getChart();
       chart.setHeightPercent(150);
       int heightPercent = chart.getHeightPercent();
       
      Returns:
      The height of the 3-D chart as a percentage of the chart width, from 5 to 500.
    • setHeightPercent

      void setHeightPercent(int value)
      Sets the height of a 3-D chart as a percentage of the chart width.

      The value must be between 5 and 500 percent.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered3D, 20, 20, 300, 200).getChart();
       chart.setHeightPercent(150);
       
      Parameters:
      value - The height of the 3-D chart as a percentage of the chart width, from 5 to 500.
    • getPerspective

      int getPerspective()
      Gets the perspective for the 3-D chart view.

      The returned value is between 0 and 100. This property is ignored if getRightAngleAxes() returns true.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered3D, 20, 20, 300, 200).getChart();
       chart.setRightAngleAxes(false);
       chart.setPerspective(30);
       int perspective = chart.getPerspective();
       
      Returns:
      The perspective for the 3-D chart view, from 0 to 100.
    • setPerspective

      void setPerspective(int value)
      Sets the perspective for the 3-D chart view.

      The value must be between 0 and 100. This property is ignored if getRightAngleAxes() returns true.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered3D, 20, 20, 300, 200).getChart();
       chart.setRightAngleAxes(false);
       chart.setPerspective(30);
       
      Parameters:
      value - The perspective for the 3-D chart view, from 0 to 100.
    • getRightAngleAxes

      boolean getRightAngleAxes()
      Gets whether the chart axes are displayed at right angles, regardless of chart rotation or elevation.

      This property applies only to 3-D line, column, and bar charts.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered3D, 20, 20, 300, 200).getChart();
       chart.setRightAngleAxes(true);
       boolean rightAngleAxes = chart.getRightAngleAxes();
       
      Returns:
      true if the chart axes are displayed at right angles; otherwise, false.
    • setRightAngleAxes

      void setRightAngleAxes(boolean value)
      Sets whether the chart axes are displayed at right angles, regardless of chart rotation or elevation.

      This property applies only to 3-D line, column, and bar charts.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered3D, 20, 20, 300, 200).getChart();
       chart.setRightAngleAxes(true);
       
      Parameters:
      value - true if the chart axes are displayed at right angles; otherwise, false.
    • getRotation

      double getRotation()
      Gets the rotation of the 3-D chart view.

      This property specifies the rotation of the plot area around the z-axis in degrees. The default value is 20. Applies only to 3-D charts.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered3D, 20, 20, 300, 200).getChart();
       chart.setRotation(30);
       double rotation = chart.getRotation();
       
      Returns:
      The rotation of the 3-D chart view, in degrees. For 3-D bar charts, the returned value is from 0 to 44; otherwise, it is from 0 to 360. The default value is 20.
    • setRotation

      void setRotation(double value)
      Sets the rotation of the 3-D chart view.

      This property specifies the rotation of the plot area around the z-axis in degrees. The default value is 20. Applies only to 3-D charts.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered3D, 20, 20, 300, 200).getChart();
       chart.setRotation(30);
       
      Parameters:
      value - The rotation of the 3-D chart view, in degrees. For 3-D bar charts, the returned value is from 0 to 44; otherwise, it is from 0 to 360. The default value is 20.
    • getShowDataLabelsOverMaximum

      boolean getShowDataLabelsOverMaximum()
      Gets whether to show data labels when a value is greater than the maximum value on the value axis.

      This property indicates whether data labels remain visible for data points that exceed the current maximum value of the value axis.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered3D, 20, 20, 300, 200).getChart();
       chart.setShowDataLabelsOverMaximum(true);
       boolean showDataLabelsOverMaximum = chart.getShowDataLabelsOverMaximum();
       
      Returns:
      true if data labels are shown for values greater than the maximum value on the value axis; otherwise, false.
    • setShowDataLabelsOverMaximum

      void setShowDataLabelsOverMaximum(boolean value)
      Sets whether to show data labels when a value is greater than the maximum value on the value axis.

      Set this property to true to keep data labels visible for data points that exceed the current maximum value of the value axis, or false to hide them.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered3D, 20, 20, 300, 200).getChart();
       chart.setShowDataLabelsOverMaximum(true);
       
      Parameters:
      value - true if data labels are shown for values greater than the maximum value on the value axis; otherwise, false.
    • getShapes

      List<IShape> getShapes()
      Gets all drawing shapes in this chart.

      The returned list contains the drawing shapes currently embedded in the chart. If the chart does not contain any drawing shapes, an empty list is returned.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       IShape autoShape = chart.addShape(AutoShapeType.Chevron, 30, 25, 120, 80);
       List<IShape> shapes = chart.getShapes();
       IShape firstShape = shapes.get(0);
       
      Returns:
      A list of drawing shapes in this chart. Returns an empty list if the chart contains no drawing shapes.
    • getPivotTable

      IPivotTable getPivotTable()
      Gets the IPivotTable associated with the chart.

      For a PivotChart, this method returns the PivotTable that supplies the chart data.

      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Product", "Amount"},
           {"Apple", 100},
           {"Orange", 200},
           {"Apple", 150}
       });
       IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:B4"));
       IPivotTable pivotTable = worksheet.getPivotTables().add(pivotCache, worksheet.getRange("D1"));
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(pivotTable.getTableRange1());
       IPivotTable linkedPivotTable = chart.getPivotTable();
       
      Returns:
      The IPivotTable associated with the chart. Returns null if the chart is not associated with a PivotTable.
    • getPivotOptions

      IPivotOptions getPivotOptions()
      Gets the pivot chart button display options.

      The returned IPivotOptions object controls whether field buttons, such as legend, axis, value, report filter, and expand or collapse buttons, are displayed on a PivotChart.

      
       Object[][] sourceData = new Object[][] {
           {"Category", "Amount"},
           {"Beverages", 100},
           {"Snacks", 200}
       };
       worksheet.getRange("A1:B3").setValue(sourceData);
       IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:B3"));
       IPivotTable pivotTable = worksheet.getPivotTables().add(pivotCache, worksheet.getRange("D1"), "PivotTable1");
       pivotTable.getPivotFields().get("Category").setOrientation(PivotFieldOrientation.RowField);
       pivotTable.getPivotFields().get("Amount").setOrientation(PivotFieldOrientation.DataField);
       IChart chart = worksheet.getShapes().addChartInPixel(ChartType.ColumnClustered, 0, 100, 360, 220).getChart();
       chart.setSourceData(pivotTable.getTableRange1());
       IPivotOptions pivotOptions = chart.getPivotOptions();
       pivotOptions.setShowLegendFieldButtons(false);
       
      Returns:
      The IPivotOptions object that specifies whether pivot chart buttons are displayed.
    • getArea3DGroup

      IChartGroup getArea3DGroup()
      Gets the IChartGroup object that represents the area chart group on a 3-D chart.

      Use this method to access group-level settings for a 3-D area chart.

      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Quarter", "Sales"},
           {"Q1", 100},
           {"Q2", 140},
           {"Q3", 120}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.Area3D, 20, 20, 300, 200).getChart();
       chart.setSourceData(worksheet.getRange("A1:B4"));
       IChartGroup areaGroup = chart.getArea3DGroup();
       areaGroup.setVaryByCategories(true);
       
      Returns:
      The IChartGroup object that represents the area chart group on a 3-D chart.
    • getBar3DGroup

      IChartGroup getBar3DGroup()
      Gets the IChartGroup object that represents the bar chart group on a 3-D chart.

      Use this method to access group-level settings for a 3-D bar chart.

      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Quarter", "Sales"},
           {"Q1", 100},
           {"Q2", 140},
           {"Q3", 120}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.BarClustered3D, 20, 20, 300, 200).getChart();
       chart.setSourceData(worksheet.getRange("A1:B4"));
       IChartGroup barGroup = chart.getBar3DGroup();
       barGroup.setGapWidth(50);
       
      Returns:
      The IChartGroup object that represents the bar chart group on a 3-D chart.
    • getColumn3DGroup

      IChartGroup getColumn3DGroup()
      Gets the IChartGroup object that represents the column chart group on a 3-D chart.

      Use this method to access group-level settings for a 3-D column chart.

      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Quarter", "Sales"},
           {"Q1", 100},
           {"Q2", 140},
           {"Q3", 120}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered3D, 20, 20, 300, 200).getChart();
       chart.setSourceData(worksheet.getRange("A1:B4"));
       IChartGroup columnGroup = chart.getColumn3DGroup();
       columnGroup.setGapWidth(50);
       
      Returns:
      The IChartGroup object that represents the column chart group on a 3-D chart.
    • getLine3DGroup

      IChartGroup getLine3DGroup()
      Gets the IChartGroup object that represents the line chart group on a 3-D chart.

      Use this method to access the chart group for a chart created with ChartType.Line3D.

      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Month", "Sales"}, {"Jan", 12}, {"Feb", 18}, {"Mar", 15}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.Line3D, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B4"));
       IChartGroup line3DGroup = chart.getLine3DGroup();
       
      Returns:
      The IChartGroup object that represents the line chart group on a 3-D chart.
    • getPie3DGroup

      IChartGroup getPie3DGroup()
      Gets the IChartGroup object that represents the pie chart group on a 3-D chart.

      Use this method to access group-level settings for a chart created with ChartType.Pie3D.

      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Category", "Sales"}, {"A", 35}, {"B", 25}, {"C", 40}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.Pie3D, 20, 20, 300, 200).getChart();
       chart.setSourceData(worksheet.getRange("A1:B4"));
       IChartGroup pie3DGroup = chart.getPie3DGroup();
       
      Returns:
      The IChartGroup object that represents the pie chart group on a 3-D chart.
    • getSurfaceGroup

      IChartGroup getSurfaceGroup()
      Gets the IChartGroup object that represents the surface chart group on a 3-D chart.

      Use this method to access group-level settings for a chart created with ChartType.Surface.

      
       worksheet.getRange("A1:D4").setValue(new Object[][] {
           {"", "Q1", "Q2", "Q3"},
           {"North", 12, 18, 15},
           {"South", 20, 16, 22},
           {"West", 14, 19, 17}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.Surface, 20, 20, 300, 200).getChart();
       chart.setSourceData(worksheet.getRange("A1:D4"));
       IChartGroup surfaceGroup = chart.getSurfaceGroup();
       
      Returns:
      The IChartGroup object that represents the surface chart group on a 3-D chart.
    • getAreaGroups

      IChartGroups getAreaGroups()
      Gets the collection of area chart groups on a 2D chart.

      Use this method to access the IChartGroups collection for the area chart groups in the current chart.

      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Month", "Sales"},
           {"Jan", 10},
           {"Feb", 20},
           {"Mar", 15}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.Area, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B4"));
       IChartGroups areaGroups = chart.getAreaGroups();
       IChartGroup areaGroup = areaGroups.get(0);
       
      Returns:
      The IChartGroups collection that contains the area chart groups on the 2D chart.
    • getBarGroups

      IChartGroups getBarGroups()
      Gets the collection of bar chart groups on a 2D chart.

      Use this method to access the IChartGroups collection for the bar chart groups in the current chart.

      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Month", "Sales"},
           {"Jan", 10},
           {"Feb", 20},
           {"Mar", 15}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.BarClustered, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B4"));
       IChartGroups barGroups = chart.getBarGroups();
       IChartGroup barGroup = barGroups.get(0);
       
      Returns:
      The IChartGroups collection that contains the bar chart groups on the 2D chart.
    • getColumnGroups

      IChartGroups getColumnGroups()
      Gets the collection of column chart groups on a 2-D chart.

      Use this method to access the IChartGroups collection for a column chart and then retrieve individual IChartGroup objects from that collection.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       IChartGroups columnGroups = chart.getColumnGroups();
       IChartGroup columnGroup = columnGroups.get(0);
       
      Returns:
      The IChartGroups collection that contains the column chart groups on a 2-D chart.
    • getDoughnutGroups

      IChartGroups getDoughnutGroups()
      Gets the collection of doughnut chart groups on a 2D chart.

      Use this method to access the IChartGroups collection for the doughnut chart groups in the current chart.

      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Category", "Sales"},
           {"North", 10},
           {"South", 20},
           {"West", 15}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.Doughnut, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B4"));
       IChartGroups doughnutGroups = chart.getDoughnutGroups();
       IChartGroup doughnutGroup = doughnutGroups.get(0);
       
      Returns:
      The IChartGroups collection that contains the doughnut chart groups on the 2D chart.
    • getLineGroups

      IChartGroups getLineGroups()
      Gets the collection of line chart groups on a 2D chart.

      Use this method to access the IChartGroups collection for the line chart groups in the current chart.

      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Month", "Sales"},
           {"Jan", 10},
           {"Feb", 20},
           {"Mar", 15}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.Line, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B4"));
       IChartGroups lineGroups = chart.getLineGroups();
       IChartGroup lineGroup = lineGroups.get(0);
       
      Returns:
      The IChartGroups collection that contains the line chart groups on the 2D chart.
    • getPieGroups

      IChartGroups getPieGroups()
      Gets the collection of pie chart groups on a 2D chart.

      Use this method to access pie chart group settings exposed through IChartGroups, such as the group definitions for pie-based 2D charts.

      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Name", "Sales"},
           {"East", 35},
           {"West", 25},
           {"North", 40}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.Pie, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B4"), RowCol.Columns, true, true);
       IChartGroups pieGroups = chart.getPieGroups();
       
      Returns:
      The collection of pie chart groups on a 2D chart.
    • getRadarGroups

      IChartGroups getRadarGroups()
      Gets the collection of radar chart groups on a 2D chart.

      Use this method to access the IChartGroups collection for the radar chart groups in the current chart.

      
       worksheet.getRange("A1:B5").setValue(new Object[][] {
           {"Category", "Score"},
           {"Speed", 80},
           {"Power", 65},
           {"Skill", 90},
           {"Focus", 75}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.Radar, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B5"));
       IChartGroups radarGroups = chart.getRadarGroups();
       IChartGroup radarGroup = radarGroups.get(0);
       
      Returns:
      The IChartGroups collection that contains the radar chart groups on the 2D chart.
    • getXYGroups

      IChartGroups getXYGroups()
      Gets the collection of scatter chart groups on a 2D chart.

      Use this method to access the IChartGroups collection for the current scatter chart. Each item in the returned collection represents a scatter chart group in the chart.

      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {1, 10},
           {2, 20},
           {3, 15},
           {4, 25}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.XYScatter, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("A1:B4"));
       IChartGroups xyGroups = chart.getXYGroups();
       
      Returns:
      The IChartGroups collection that contains the scatter chart groups on the 2D chart.
    • getChartGroups

      IChartGroups getChartGroups()
      Gets the collection of all chart groups in the chart.

      Use this method to access the IChartGroups collection for the current chart. The returned collection includes every chart group in the chart, including groups created by different chart types.

      
       worksheet.getRange("A1:C4").setValue(new Object[][] {
           {"Month", "Sales", "Target"},
           {"Jan", 10, 12},
           {"Feb", 20, 18},
           {"Mar", 15, 16}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.getSeriesCollection().add(worksheet.getRange("B1:C4"));
       chart.getSeriesCollection().get(1).setChartType(ChartType.Line);
       IChartGroups chartGroups = chart.getChartGroups();
       IChartGroup chartGroup = chartGroups.get(0);
       
      Returns:
      The IChartGroups collection that contains all chart groups in the current chart.
    • addShape

      IShape addShape(AutoShapeType type, double left, double top, double width, double height)
      Adds an AutoShape to the chart and returns the corresponding IShape object.

      The shape is positioned relative to the upper-left corner of the chart area, and its size and position are specified in points.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       IShape autoShape = chart.addShape(AutoShapeType.Chevron, 30, 25, 120, 80);
       autoShape.getFill().getColor().setRGB(Color.GetBlue());
       
      Parameters:
      type - The type of AutoShape to create.
      left - The distance from the left edge of the AutoShape's boundary box to the left edge of the chart area, in points.
      top - The distance from the top edge of the AutoShape's boundary box to the top edge of the chart area, in points.
      width - The width of the AutoShape's boundary box, in points.
      height - The height of the AutoShape's boundary box, in points.
      Returns:
      The IShape object that represents the new AutoShape.
      Throws:
      IllegalArgumentException - if type is AutoShapeType.None.
    • addChart

      IShape addChart(ChartType chartType, double left, double top, double width, double height)
      Creates a chart at the specified location in this chart.

      The new chart is positioned relative to the upper-left corner of the chart area, and the returned IShape represents the created chart shape.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       IShape insetChart = chart.addChart(ChartType.Line, 30, 25, 120, 90);
       
      Parameters:
      chartType - The type of chart to create.
      left - The distance from the left edge of the new chart to the left edge of the chart area, in points.
      top - The distance from the top edge of the new chart to the top edge of the chart area, in points.
      width - The width of the new chart, in points.
      height - The height of the new chart, in points.
      Returns:
      The IShape object that represents the new chart.
    • addConnector

      IShape addConnector(ConnectorType type, double beginX, double beginY, double endX, double endY)
      Creates a connector shape in the chart area and returns the IShape object that represents the new connector shape.

      The connector is positioned by its start and end points relative to the upper-left corner of the chart area, in points.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       IShape connector = chart.addConnector(ConnectorType.Straight, 30, 40, 180, 120);
       connector.getLine().setWeight(2);
       
      Parameters:
      type - The type of connector shape to create.
      beginX - The horizontal position of the connector shape's starting point relative to the upper-left corner of the chart area, in points.
      beginY - The vertical position of the connector shape's starting point relative to the upper-left corner of the chart area, in points.
      endX - The horizontal position of the connector shape's ending point relative to the upper-left corner of the chart area, in points.
      endY - The vertical position of the connector shape's ending point relative to the upper-left corner of the chart area, in points.
      Returns:
      The IShape object that represents the new connector shape.
    • addPicture

      IShape addPicture(String filename, double left, double top, double width, double height) throws IOException
      Creates a picture from an existing file and adds it to the chart.

      The picture is positioned relative to the upper-left corner of the chart area, and the returned IShape represents the newly created picture.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       IShape picture = null;
       try {
           String imagePath = java.nio.file.Paths.get("Users", "DefaultApps", "Documents", "logo.png").toString();
           picture = chart.addPicture(imagePath, 40, 30, 120, 80);
       } catch (IOException e) {
       }
       
      Parameters:
      filename - The file from which the picture is created. Must not be null.
      left - The distance from the left edge of the picture to the left edge of the chart area, in points.
      top - The distance from the top edge of the picture to the top edge of the chart area, in points.
      width - The width of the picture, in points.
      height - The height of the picture, in points.
      Returns:
      The IShape object that represents the new picture.
      Throws:
      IOException - if the file cannot be read.
    • addPicture

      IShape addPicture(InputStream stream, ImageType type, double left, double top, double width, double height) throws IOException
      Creates a picture from an existing stream and adds it to the chart.

      The picture is positioned relative to the chart area. The left, top, width, and height values are measured in points.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       byte[] pictureBytes = java.util.Base64.getDecoder().decode("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQIHWP4////fwAJ+wP9KobjigAAAABJRU5ErkJggg==");
       IShape picture = null;
       try (java.io.ByteArrayInputStream stream = new java.io.ByteArrayInputStream(pictureBytes)) {
           picture = chart.addPicture(stream, ImageType.PNG, 40, 30, 120, 80);
       } catch (java.io.IOException e) {
       }
       
      Parameters:
      stream - The stream that provides the picture data. Must not be null.
      type - The type of the picture data in the stream.
      left - The distance from the left edge of the picture to the left edge of the chart area, in points.
      top - The distance from the top edge of the picture to the top edge of the chart area, in points.
      width - The width of the picture, in points.
      height - The height of the picture, in points.
      Returns:
      The IShape object that represents the new picture.
      Throws:
      IOException - if an I/O error occurs while reading the stream.
    • addShapeInPixel

      IShape addShapeInPixel(AutoShapeType type, double left, double top, double width, double height)
      Creates an AutoShape in this chart using pixel-based coordinates.

      The shape is positioned relative to the upper-left corner of the chart area, and the returned IShape represents the newly created AutoShape.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       IShape autoShape = chart.addShapeInPixel(AutoShapeType.Chevron, 30, 25, 120, 80);
       autoShape.getFill().getColor().setRGB(Color.GetBlue());
       
      Parameters:
      type - The type of AutoShape to create.
      left - The distance from the left edge of the AutoShape's boundary box to the left edge of the chart area, in pixels.
      top - The distance from the top edge of the AutoShape's boundary box to the top edge of the chart area, in pixels.
      width - The width of the AutoShape's boundary box, in pixels.
      height - The height of the AutoShape's boundary box, in pixels.
      Returns:
      The IShape object that represents the new AutoShape.
      Throws:
      IllegalArgumentException - if type is AutoShapeType.None.
    • addChartInPixel

      IShape addChartInPixel(ChartType chartType, double left, double top, double width, double height)
      Creates a chart at the specified location in this chart using pixel-based coordinates.

      The new chart is positioned relative to the upper-left corner of the chart area, and the returned IShape represents the created chart shape.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       IShape insetChart = chart.addChartInPixel(ChartType.Line, 40, 30, 160, 100);
       
      Parameters:
      chartType - The type of chart to create.
      left - The distance from the left edge of the new chart to the left edge of the chart area, in pixels.
      top - The distance from the top edge of the new chart to the top edge of the chart area, in pixels.
      width - The width of the new chart, in pixels.
      height - The height of the new chart, in pixels.
      Returns:
      The IShape object that represents the new chart.
    • addConnectorInPixel

      IShape addConnectorInPixel(ConnectorType type, double beginX, double beginY, double endX, double endY)
      Creates a connector in the chart using pixel-based coordinates.

      The connector's start and end points are measured from the upper-left corner of the chart area in pixels. This method returns the IShape object that represents the newly created connector.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       IShape connector = chart.addConnectorInPixel(ConnectorType.Straight, 30, 40, 180, 120);
       connector.getLine().setWeight(2);
       
      Parameters:
      type - The ConnectorType of the connector to create.
      beginX - The horizontal position of the connector's starting point relative to the upper-left corner of the chart area, in pixels.
      beginY - The vertical position of the connector's starting point relative to the upper-left corner of the chart area, in pixels.
      endX - The horizontal position of the connector's end point relative to the upper-left corner of the chart area, in pixels.
      endY - The vertical position of the connector's end point relative to the upper-left corner of the chart area, in pixels.
      Returns:
      The IShape object that represents the new connector.
    • addPictureInPixel

      IShape addPictureInPixel(String filename, double left, double top, double width, double height) throws IOException
      Creates a picture from an existing file and adds it to the chart using pixel-based coordinates.

      The picture is positioned relative to the upper-left corner of the chart area, and the returned IShape represents the newly created picture.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       IShape picture = null;
       try {
           String imagePath = java.nio.file.Paths.get("Users", "DefaultApps", "Documents", "logo.png").toString();
           picture = chart.addPictureInPixel(imagePath, 30, 25, 80, 60);
           picture.setName("Logo");
       } catch (IOException e) {
       }
       
      Parameters:
      filename - The file from which the picture is created. Must not be null.
      left - The distance from the left edge of the picture to the left edge of the chart area, in pixels.
      top - The distance from the top edge of the picture to the top edge of the chart area, in pixels.
      width - The width of the picture, in pixels.
      height - The height of the picture, in pixels.
      Returns:
      The IShape object that represents the new picture.
      Throws:
      IOException - if the file cannot be read.
    • addPictureInPixel

      IShape addPictureInPixel(InputStream stream, ImageType type, double left, double top, double width, double height) throws IOException
      Creates a picture from an existing stream at the specified position and size, measured in pixels, and returns the shape that represents the picture.

      The picture is added relative to the chart area. Use this method when the image content is available as a stream and the picture position and size need to be specified in pixel units.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       byte[] imageData = java.util.Base64.getDecoder().decode("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+jmioAAAAASUVORK5CYII=");
       IShape picture = null;
       try (java.io.InputStream stream = new java.io.ByteArrayInputStream(imageData)) {
           picture = chart.addPictureInPixel(stream, ImageType.PNG, 30, 25, 80, 60);
           picture.setName("Logo");
       } catch (IOException e) {
       }
       
      Parameters:
      stream - The stream that provides the image data. Must not be null.
      type - The image type of the stream data.
      left - The distance from the left edge of the picture to the left edge of the chart area, in pixels.
      top - The distance from the top edge of the picture to the top edge of the chart area, in pixels.
      width - The width of the picture, in pixels.
      height - The height of the picture, in pixels.
      Returns:
      The IShape object that represents the new picture.
      Throws:
      IOException - if an I/O error occurs while reading the image stream.
    • setSourceData

      void setSourceData(IRange source, RowCol plotBy)
      Sets the source data range for the chart and specifies whether each data series is taken from rows or columns.

      Use the plotBy parameter to control how the chart interprets the source range when creating series and categories.

      
       worksheet.getRange("A1:C4").setValue(new Object[][] {
           {"Month", "North", "South"},
           {"Jan", 10, 12},
           {"Feb", 15, 18},
           {"Mar", 13, 16}
       });
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.setSourceData(worksheet.getRange("A1:C4"), RowCol.Columns);
       
      Parameters:
      source - The range that contains the source data. Must not be null.
      plotBy - Specifies whether the chart reads each data series from RowCol.Columns or RowCol.Rows.
    • setSourceData

      void setSourceData(IRange source)
      Sets the source data range for the chart.

      The specified range is used as the chart's data source.

      
       IRange range = worksheet.getRange("A1:B4");
       range.setValue(new Object[][] {{"Month", "Sales"}, {"Jan", 10}, {"Feb", 15}, {"Mar", 12}});
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.setSourceData(range);
       
      Parameters:
      source - The range that contains the source data. Must not be null.
    • delete

      void delete()
      Deletes the chart from the worksheet.

      After this method is called, the chart is removed from the worksheet's shapes collection.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
       chart.delete();