[]
        
(Showing Draft Content)

IChartFormat

Interface IChartFormat


public interface IChartFormat
Provides access to the Office Art formatting for chart elements.

Use this interface to work with the fill, line, and 3-D formatting exposed by a chart element's format object. An instance is typically obtained from another chart API such as a chart area, series, axis, legend, or data label.


 worksheet.getRange("A1:B4").setValue(new Object[][] {
     {"Month", "Sales"},
     {"Jan", 10},
     {"Feb", 15},
     {"Mar", 12}
 });
 IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
 chart.getSeriesCollection().add(worksheet.getRange("A1:B4"), RowCol.Columns, true, true);
 IChartFormat chartFormat = chart.getChartArea().getFormat();
 chartFormat.getFill().getColor().setRGB(Color.GetBlue());
 
  • Method Details

    • getFill

      IFillFormat getFill()
      Gets the IFillFormat object for the chart element.

      Use the returned IFillFormat object to access and modify the fill formatting properties of the parent chart element.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 360, 220).getChart();
       IChartFormat format = chart.getChartArea().getFormat();
       IFillFormat fill = format.getFill();
       fill.getColor().setRGB(Color.GetRed());
       
      Returns:
      The IFillFormat object that contains the fill formatting properties of the chart element.
    • getLine

      ILineFormat getLine()
      Gets the ILineFormat object for the chart element.

      Use the returned ILineFormat object to access and modify the line formatting properties of the specified chart element.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 360, 220).getChart();
       IChartFormat format = chart.getChartArea().getFormat();
       ILineFormat line = format.getLine();
       line.getColor().setRGB(Color.GetRed());
       
      Returns:
      The ILineFormat object that contains the line formatting properties of the chart element.
    • getThreeD

      IThreeDFormat getThreeD()
      Gets the IThreeDFormat object for the chart element.

      Use the returned IThreeDFormat object to access and modify the 3-D formatting properties of the specified chart element, such as rotation, perspective, and visibility.

      
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 360, 220).getChart();
       IChartFormat format = chart.getChartArea().getFormat();
       IThreeDFormat threeD = format.getThreeD();
       threeD.setRotationX(20);
       
      Returns:
      The IThreeDFormat object that contains the 3-D formatting properties of the chart element.